AllExperts > DHTML 
Search      
DHTML
Volunteer
Answers to thousands of questions
 Home · More DHTML Questions · Answer Library  · Encyclopedia ·
More DHTML Answers
Question Library

Ask a question about DHTML
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Andrew Hoffman
Expertise
I can field just about any question within this topic ranging from JavaScript to CSS, the two ingredients of DHTML. I`m very interested in the W3C and its validation rules for HTML, XHTML, and CSS, and enjoy answering questions of this type as well. I detest sleep and respond at all hours of the day or night.


Experience
Experience in the area
I've been working with DHTML and CSS for 7 years now and build/maintain websites of my own that implement DHTML navigation.

What I'm doing now
My contract with Microsoft has ended and I am working for myself once again. Please contact me for any front-end work at antibland@gmail.com

 
   

You are here:  Experts > Computing/Technology > HTML/XML > DHTML > Union/Intersections of styles

DHTML - Union/Intersections of styles


Expert: Andrew Hoffman - 6/18/2007

Question
Hi Andrew!
I have a question related to CSS which I'm not sure is valid or not :-). So I guess I will hit the question directly and leave it for you to decide whether I'm on the right track or not.
I have a few tags in my html document with multiple (whitespace separated) values for the class attribute. [I read somewhere on the w3c that the class can have multiple values.] Then I created 3 style elements in the "head".
1) All tags should have display: none
2) Tags with class "class1" should have display: block
3) Tags with class "class2" should have display: block
The problem here is that the browser is displaying a union of both style elements (as per my css, this is valid). What I want it to show is an intersection, meaning, I want the browser to show all tags with class having "class1" and "class2" and hide all others.

How do I make it display only an intersection of the last 2 styles instead of a union ?
Please let me know if I'm unclear on what I wish to ask or if I need to upload an example somewhere and provide a link to it.

Thanks in advance,
Parag P. Doke
http://paragpdoke.blogspot.com

Answer
Parag,

Would you be able to upload a sample page for me to look at?  This way, I could tinker in a more efficient way.  However, I would try this first (maybe we'll get lucky).  Add this to the end of your styles.

.class1, class2 {
 display: block !important;
}

- Andrew

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.