Skip to content Skip to sidebar Skip to footer

How To Avoid Child Elements To Get Text-decoration Style From Body Element's Style

HTML example: line1
subline1
subline2&l

Solution 1:

First I would recommend to avoid using inline Css and !important, that's a bad practice and will make your code very hard to modify later. one solution would be to put your text decoration on the span:

<span style ="text-decoration: underline;">
line1
</span>

Solution 2:

You can get rid of text-decoration set on an ancestor using

display: inline-block;

Since in your case your elements are blocks, you may also want

width: 100%;

to make them more block-like.

Demo


Solution 3:

Here you go! http://jsfiddle.net/41ragvd2/

<body style="font-family: Arial; font-size: 8px; color: rgb(255, 0, 85); font-weight: bold; font-style: italic;" >
<span style="text-decoration: underline;">
line1
</span>

<div style="color:black; !important;">
<div style="color:green; !important;">
subline1
</div>

<div>
subline2
</div
</div>
</body>

Post a Comment for "How To Avoid Child Elements To Get Text-decoration Style From Body Element's Style"