Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Superscript underline moves up with text

Tags:

html

css

I have HTML code something like:

<div id="blah">
   We have winner of 1<sup>st</sup> Tournament
</div>

with css

#blah{
text-decoration:underline;
}

But this moves underline of st to top and it looks wierd. Is there any way that i can fix it using css only

like image 446
user2389411 Avatar asked May 30 '13 11:05

user2389411


2 Answers

Its simple try this

#blah sup{
display:inline-block;
border-bottom:1px solid #000;
padding-bottom:2px;//as per your requirement
}
like image 183
edd Avatar answered Oct 04 '22 23:10

edd


use border-bottom instead of text-decoration (If you have only one line of text)

#blah{
    border-bottom:solid 1px black;
    display:inline-block;
    line-height:15px
}

DEMO

like image 33
Sowmya Avatar answered Oct 04 '22 23:10

Sowmya