Reputation: 15477
I have a bunch of divs like the following on one page. Is there a way in css to bold just the first line (before the <br/>
)? So, in this instance, I would want Customer in bold.
<div>
Customer
<br/>
John Doe
</div>
Upvotes: 5
Views: 4025
Reputation: 48
I am not too good at css but hope this pseudo-element doucmentation help more to lean about pseudo selectors. and Thanks to @MKN Web Solutions for great and quick answer.
http://www.w3.org/TR/css3-selectors/#first-line
Upvotes: 0
Reputation: 118166
There is a ::first-line selector. According to QuirksMode, it is widely supported. MDN provides more information.
Upvotes: 0
Reputation: 2794
Yes, you're looking for the ::first-line pseudo-element.
So basically you'd do:
div::first-line{
font-weight:bold
}
Upvotes: 13
Reputation: 208032
use the :first-line pseudo-element:
div::first-line {
font-weight:bold;
}
<div>
Customer
<br/>
John Doe
</div>
Upvotes: 4
Reputation: 38262
Use pseudo-element ::first-line
div::first-line {
font-weight:700;
}
<div>
Customer
<br/>
John Doe
</div>
Upvotes: 2