Click here to Skip to main content
15,894,313 members
Please Sign up or sign in to vote.
2.20/5 (3 votes)
See more:
HEllo evereyone,

i wrote this code
i need space before LETS and space after Begin in HTML hr tag .
secondily i want to reduce the hr line size from leftside and rightside.
and i want to color Lets Begin word.
Please help me for my requirements.Please find the below code.

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%;background-color: white; position: relative; top: -0.5em;">
   <p3> Lets Begin</p3>
  </span>
</div>
</td>
</tr>
</table>


Thanks
HArshal
Posted
Updated 24-Oct-15 0:00am
v2
Comments
R Harshal 24-Oct-15 6:35am    
Please guide me for : to reduce the hr line size from leftside and rightside.
and i want to color Lets Begin word.
Richard MacCutchan 24-Oct-15 6:46am    
What is "hr line size"? Also, you can use CSS or <span> to colour the text.
R Harshal 24-Oct-15 6:45am    
Answer is incomplete.Anyone can guide me for the same.
Krunal Rohit 25-Oct-15 2:03am    
where's
anyway ?

-KR

This should help. I changed background-color, added width, color, font-weight, and used padding to give you the space. Adjust to your needs.

XML
<div style="height:2px; background-color: #8000FF; text-align: center; width: 200px;">
  <span style="margin-right:-5%; margin-left:-5%;background-color: red; color: #fff; font-weight: bold; position: relative; top: -0.5em; padding-right: 10px; padding-left: 10px;">
   Lets Begin
  </span>
</div>
 
Share this answer
 
 
Share this answer
 
I'd suggest you to use :after and :before selectors from CSS.

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

.lw span{
  color: #f44;
}

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

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


Live Demo: Line before/after the Text[^]

:after
:before

-KR
 
Share this answer
 
v4
There is a special character called non-breaking-space.
It is used like that:
HTML
<p3>&nbsp;Lets Begin</p3>
 
Share this answer
 
Comments
R Harshal 24-Oct-15 6:19am    
secondily i want to reduce the hr line size from leftside and rightside.
and i want to color Lets Begin word.

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