|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
simple css question
scenario: i applied some styles to the p (paragraph) tag, so text in a paragraph is a certain color and size and whatever. however when i attempt to put a word within the bold tag (<b>), nothing happens, the text i want to be bold is unaffected (its not bold like i want it to be). do you have to use a work around when it comes to making text bold in css? thanksNadvance
|
|
#2
|
||||
|
||||
|
Well, since you're using CSS, you should't be using the <b> tag anyway b/c it's a formatting/style tag. Instead, use a <span> tag and apply a class to it and add that class to your stylesheet. That way, in the future, if you no longer want the words bold, but maybe italic instead, you can change just the stylesheet. After all, that is the advantage.
Code:
<style type="text/css">
p
{
color: red;
font-size: 1em;
}
.keyword
{
font-weight: bold;
}
</style>
Code:
<p>This is some a <span class="keyword">keyword</span>, which is bold!</p> |
|
#3
|
|||
|
|||
|
thanks jharnois,
actually i never heard of the span tag, is it a generic tag meant to be applied to miscelaneous styles? |
|
#4
|
||||
|
||||
|
It's an inline tag whereas <p> is a block tag.
|
|
#5
|
||||
|
||||
|
<span> is a tag that's meant only for carrying style information; it has no effect on its own. When you stick a style into a <div> tag, for example, you get the style information and the extra line break from <div>'s normal function. <span> doesn't have a normal function like that, so you can use it without it changing anything else.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > simple css question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|