Click here to Skip to main content
15,921,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

i want to set the text between the line.
it should looks like as follows in center

--------- Lets begin ----------

line should be plane not dotted.
i wrote the code as follows:
XML
<table width="600"  cellpadding="0" cellspacing="0" align="center" class="deviceWidth" bgcolor="" style="margin-top:1%">
<tr>
<td align="left">
<div style="height:2px; background-color: #8000FF; text-align: center">
  <span style=" margin-right:-5%; margin-left:-5%; position: relative; top: -0.5em; color:blue; font-weight:bold;"><br>
   <p3> &nbsp; Lets begin &nbsp;</p3><br>
  </span>
</div>
</td>
</tr>
</table>
Posted

It is not clear why do you use br (line break) tags and what p3 tag is...but...
HTML
<div style="height:2px; background-color: #8000FF; text-align: center;">
    <span style="position: relative; top: -0.5em; background-color: white; padding: 5px;">Lets begin</span>
</div>
 
Share this answer
 
Here's the tools you'll need:

HTML
<hr> to draw solid lines wherever you wish
style='position=relative; or, possibly even 'absolute;'
top and left styles to position your text
<div> to surround things so they can be positioned



You can see how these items are used here:
http://www.w3schools.com/html/default.asp[^]

Learning to position this yourself (with associated trial an error) is worth it for you.
 
Share this answer
 
Just yesterday I gave this solution with the working fine demo.
Did you look into it ?
HTML
<p class="lw">Let's Begin</p>

CSS
.lw { font-size: 60px; }

.lw span{
  color: #f44;
}

.lw:before{
  display: inline-block;
  content: ' ';
  height: 2px;
  width: 100px;
  background-color: #f44;
  margin-bottom: 20px;
}

.lw:after{
  display: inline-block;
  content: ' ';
  height: 2px;
  width: 100px;
  background-color: #000;
  margin-bottom: 20px;
}

See my answer here:
HTML HR LINE related issue.[^]
This is exactly what you want :)

-KR
 
Share this answer
 
v3
Try-
HTML
<p style="width:100%;text-align:center;">Lets begin</p>


Note:- It is best to use CSS selector instead of inline styles.

Hope, it helps :)
 
Share this answer
 
v2
For example, this way:
HTML
<html>
    <head>
        <title>Solid line</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <style>
        center. { text-align:center; }
    </style>
<body>

<p class="center">────────── Letʼs begin ──────────</p>

</body>
</html>
:-)

Pay attention for the meta tag, it's essential. Your spelling is fixed. :-)
I don't want to discuss your design style, but want to note: many will find it questionable.

—SA
 
Share this answer
 
v5
Comments
[no name] 27-Oct-15 1:30am    
thanks to all of you ...
Sergey Alexandrovich Kryukov 27-Oct-15 2:06am    
You are welcome.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900