Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Styling of Elements Within Class Applying to Entire Document

10:37 pm on May 6, 2011 (gmt 0)

New User

5+ Year Member

joined:June 7, 2008
posts: 6
votes: 0

I am trying to style elements only within the DIV of class "fmodule", but the styles are applying to the entire document.

.fmodule h1,h2 {margin-top:30px;margin-bottom:12px; font-family:Arial,Helvetica,Verdana,sans-serif; color:#545454}
.fmodule h3,h4,h5,h6 {margin-top:30px;margin-bottom:8px; font-family:Arial,Helvetica,Verdana,sans-serif; color:#2ca9e4}
.fmodule h1,h2,h3,h4,h5,h6 {text-transform:uppercase;}

If I change it to the following syntax, it works

h1.fmodule,h2.fmodule {margin-top:30px;margin-bottom:12px; font-family:Arial,Helvetica,Verdana,sans-serif; color:#545454}
h3.fmodule,h4.fmodule,h5.fmodule,h6.fmodule {margin-top:30px;margin-bottom:8px; font-family:Arial,Helvetica,Verdana,sans-serif; color:#2ca9e4}
h1.fmodule,h2.fmodule,h3.fmodule,h4.fmodule,h5.fmodule,h6.fmodule {text-transform:uppercase;}

but it seems as if it should only work if I have a class specified for each element, which I do not.

<h1 class="fmodule">


2:09 am on May 7, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
votes: 24

The problem is your selectors. You have:

.fmodule h1, h2

But I think what you are trying to achieve is:

.fmodule h1, .fmodule h2
7:27 am on May 7, 2011 (gmt 0)

New User

5+ Year Member

joined:June 7, 2008
posts: 6
votes: 0

You are correct! Worked as expected.

Appreciate it.