sandy1028 Posted December 26, 2012 Share Posted December 26, 2012 Please tell me how to use styling. When I use css for underline, even the (subtitle) gets underlined. How to avoid that. <div class="headline">For-Profit Businesses<div> (subheadline)</div></div> Quote Link to comment https://forums.phpfreaks.com/topic/272368-underline-only-first-part/ Share on other sites More sharing options...
ignace Posted December 26, 2012 Share Posted December 26, 2012 .headline { text-decoration: underline; } .headline div { text-decoration: none; } Quote Link to comment https://forums.phpfreaks.com/topic/272368-underline-only-first-part/#findComment-1401291 Share on other sites More sharing options...
Christian F. Posted December 26, 2012 Share Posted December 26, 2012 Also, I'd use semantical HTML in this case. Not only would it make the styling a lot easier, but its also better for search-bots, screen readers and more. With this HTML, assuming the first headline is the topmost headline for the page/section. <h1>For-Profit Businesses</h1> <h2>(Subheadline)</h2> You'll have the following CSS: h1 {text-decoration: underline;} Of course, you'll probably want to add some more styles to them, to make them look exactly as you want. But, for the question at hand that's all you need. Quote Link to comment https://forums.phpfreaks.com/topic/272368-underline-only-first-part/#findComment-1401310 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.