+ 2

How to put a text in between a line?

For example: -----------------text here----------------

2nd Jan 2022, 5:26 AM
Uniq-L
Uniq-L - avatar
3 Answers
+ 3
<!DOCTYPE html> <html> <head> <title>Page Title</title> <style> .container{ width:100%; display:flex; align-items: center; } .line{ background-color: #000; /* set the percentage the width of eac part of the line sould occupy here */ width:40%; /* set the heigth of the line here */ height: 4px; } .text{ text-align:center; /* set the percentage of the width of the text here */ width:20%; } </style> </head> <body> <div class="container"> <div class="line"></div> <p class="text">Text here</p> <div class="line"></div> </div> </body> </html> https://code.sololearn.com/Wg85zJVaV5PL/?ref=app
2nd Jan 2022, 11:51 AM
Elon
Elon - avatar
+ 1
No I mean, as you can put a horizontal line , now I want that line to have a text between it
2nd Jan 2022, 6:16 AM
Uniq-L
Uniq-L - avatar
0
The line would be some element's border.
2nd Jan 2022, 6:08 AM
FanYu
FanYu - avatar