homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Styling of Elements Within Class Applying to Entire Document

5+ Year Member

Msg#: 4309048 posted 10:37 pm on May 6, 2011 (gmt 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">





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

Msg#: 4309048 posted 2:09 am on May 7, 2011 (gmt 0)

The problem is your selectors. You have:

.fmodule h1, h2

But I think what you are trying to achieve is:

.fmodule h1, .fmodule h2


5+ Year Member

Msg#: 4309048 posted 7:27 am on May 7, 2011 (gmt 0)

You are correct! Worked as expected.

Appreciate it.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved