Reputation: 20078
I am not a css expert but still trying to learn the best way...
I have a div
and in that div I am showing a message and the first half message is bold and the second half the message is regular. Like this below
It’s a bit complicated to get JSONP working with a simple WCF service.
Luckily, there’s some sample code on MSDN to do it for you; it’s just not obvious how to take advantage of it. Here it is in 3 “easy” steps!
My css is like this:
#formmsg.text-success
{
color:black;
font-weight:bold;
margin:0px 0px 10px;
}
My question is, how can I use style for bold/regular or do I need to create another style for that?
Upvotes: 4
Views: 55047
Reputation: 686
<p><b>It’s a bit complicated to get JSONP working with a simple WCF service.</b></p>
<p>Luckily, there’s some sample code on MSDN to do it for you; it’s just not obvious how to take advantage of it. Here it is in 3 “easy” steps!</p>
OR
<p class="bold">It’s a bit complicated to get JSONP working with a simple WCF service.</p>
<p>Luckily, there’s some sample code on MSDN to do it for you; it’s just not obvious how to take advantage of it. Here it is in 3 “easy” steps!</p>
with css
.bold{
font-weight:bold;}
Upvotes: 2
Reputation: 490657
You could do this...
<p>It’s a bit complicated to get JSONP working with a simple WCF service.</p>
<p>Luckily, there’s some sample code on MSDN to do it for you; it’s just not obvious how to take advantage of it.</p>
p:first-child {
font-weight: bold;
}
Note this won't work in IE6. You will also no doubt have many more p
elements on your page, so provide a parent element in the selector.
Upvotes: 8
Reputation: 14776
You can change the style on the fly using Javascript to change either the CSS or to change your class. So you could create another class that does not have a font-weight of bold and change classes. Or you can just change the font-weight: bold on the fly by itself. I'd lean towards another class as being more semantically correct in this case. How you do it depends on if you are using pure Javascript or a framework.
Upvotes: 1