Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spacing between text and underline

Tags:

html

css

I am looking for a way to enlarge the distance between the text and underline on my pages. i use mainly CSS but i had to use tags as well, basicly my question considers both cases. is there a way to change this spacing? the code is pretty simple:

.title_span {
 font-weight: bold;
 text-decoration: underline;
 color: grey;
}

my other posibility is try somehow use background for the span using 1px picture and repeat against X axis i am looking for cleaner solution.

like image 356
antonpuz Avatar asked Nov 18 '13 12:11

antonpuz


People also ask

How do I change the space between underline and text?

In the following “Font” dialog box, switch to “Advanced” page. Select “Raised” in the “Position” box, and enter a specific number you want in the “By” box. For example, here we enter “6 pt”. Note that the larger the value we enter, the more space there will be between texts and underline.

How do you keep the underline away from text?

To remove single underlining from words and spaces, select the underlined text and press Ctrl+U. To remove other styles of underlining, press Ctrl+U twice.


1 Answers

Not without tricks, no. One simple solution is to wrap the text in another span and give that a bottom border.

<span class="underline"><span class="title_span">title of something</span></span>

.title_span {
 font-weight: bold;
 text-decoration: underline;
 color: grey;
}

.underline {
    padding-bottom: 2px;
    border-bottom: grey 1px solid;
}

http://jsfiddle.net/m9RQ9/

like image 166
Aaron Digulla Avatar answered Oct 27 '22 04:10

Aaron Digulla