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)

5+ Year Member

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)

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

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)

5+ Year Member

You are correct! Worked as expected.

Appreciate it.

Featured Threads

Hot Threads This Week

Hot Threads This Month