6 replies [Last post]
benny
Offline
Enthusiast
Last seen: 14 years 51 weeks ago
Joined: 2004-08-24
Posts: 64
Points: 0

Hi again,

i got the following problem:

in my stylesheet i define h3:

h3 {
background: none;
color: #666666;
font-size: 80%;
margin-left: 20px;
}

and

#infobox h3
h3 {
background: none;
color: #fff;
font-size: 80%;
}

but when i use #infobox h3, only the color of the text changes, but not margin-left:20px.

Whats wrong with that?
thx,
greets ben

TimeBandit
Offline
Enthusiast
Maryland, USA
Last seen: 18 years 5 weeks ago
Maryland, USA
Joined: 2004-09-02
Posts: 112
Points: 0

div-specific h3

infobox h3 needs margin-left: 0px if you want to take the 20px off from the previous h3 declaration

wolfcry911
wolfcry911's picture
Offline
Guru
MA, USA
Last seen: 8 years 31 weeks ago
MA, USA
Timezone: GMT-5
Joined: 2004-09-01
Posts: 3224
Points: 237

div-specific h3

And it's probably just a mistake in your post but you got a double h3 there...

benny
Offline
Enthusiast
Last seen: 14 years 51 weeks ago
Joined: 2004-08-24
Posts: 64
Points: 0

div-specific h3

Thank you, with margin-left: 0px it's all fine.. Smile
And thx for your atttention wolfcry, it was a mistake in the post.

But whats the reason for that?
Do you know a good website where this is explanined?
Greets,
ben

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 23 weeks 4 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

div-specific h3

The simple h3 rule would be applied to every h3. If you change things in div specific h3s, this would only affect what is written. For example, if instead of color: #fff, you put font-size: 120%, it would change the font size but not the color.

And by the way, you don't need to specify background: none and font-size in the div-specific h3.

Verschwindende wrote:
  • CSS doesn't make pies

TimeBandit
Offline
Enthusiast
Maryland, USA
Last seen: 18 years 5 weeks ago
Maryland, USA
Joined: 2004-09-02
Posts: 112
Points: 0

div-specific h3

benny wrote:
Thank you, with margin-left: 0px it's all fine.. Smile
But whats the reason for that?
Do you know a good website where this is explanined?

that would be the "cascading" part of "Cascading Style Sheets" Smile
you define an h3. every h3 will have those qualities. if you define <h3 class="WayCool"> then it too will have the same qualities because it is an h3, however you can change some of the instances of that specific class of h3 by declaring new code for it with "h3.WayCool"

in the following example, all h3's wll be 12px tall and black in color, but only "WayCool" h3 tags will be red and 12px tall.
h3 { font-size:12px; color: black}
h3.WayCool { color: red }

benny
Offline
Enthusiast
Last seen: 14 years 51 weeks ago
Joined: 2004-08-24
Posts: 64
Points: 0

div-specific h3

Thank ya all for your answers!
I'm a littlebit smarter now Wink