Well, I though of that, There will other upper elemnts which may have impact, hence just dont want .xMain div to apply to to these element, rest all it should inherit
Main Topics
Browse All TopicsI have div say with class name "xMain"
<div class="xMain>
<div></div>
.....
<div></div>
</div>
In my css:
i have code
.xMain div{
float:left;
display:inline;
overflow: hidden;
}
I want to prevent some particular div inside xMain from getting these properties.
how to do that through css or something, I can't change this format because there lot places where it will effect,there only few div(that too sometimes) , which will need to by pass this.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
What you're trying to accomplsh can't be done without using a more specific selector. You need to find a way to mark with a class name or a specific attribute, but you can only use attribute selectors for IE6+ the exact div's you want to keep the default styles or overwrite the styles defined by you with .xMain div { }.
Try this:
<style type="text/css"/>
.xMain {background-color:#fc0; display:block; overflow:hidden;}/*--CSS for emphasizing purpose--*/
.xMain div{float:left;display:inl
background-color:#f00; margin:5px;/*--CSS for emphasizing purpose--*/
}
.xMain div[title~="marker"] {background-color:transpar
.xMain div.markerClass {background-color:transpar
</style>
I did. I assume you're not inserting the DIV elements on your own and you have some script that generates that markup. In the above snippet, for the DIV elements you want to rewrite CSS properties, you need to alter the script so that whenever it's about to generate a DIV element that you don't want to inherit the properties, you just create a conditional to append class="markerClass". Then the CSS code provided above should do the rest.
If we're talking about CSS Level 3, there's the :not selector available, but it's poorly supported across browsers. Firefox, Chrome and Safari (not sure about this one) have support for it.
Here's what I suggest though, because we seem to be drifting away from the problem.
From what I understand, you wish to style only certain < div > tags nested within the < div > tag that has a class "xMain".
Say you have the markup generated something like the snippet below. What you need to do in this case is choose one of the following:
- either you style the elements that actually need styling by specifing the class name:
.xMain div.iCanInheritTheStyle {...}
- or you can style the child div elements globally by using your original css
.xMain div {...}
and then revert back the styles to the default values for the elements you wish to be left alone, by using:
.xMain div.keepMeOnDefaultStyles {...}
Either solution requires you to generate a class name on one of the types of elements. Else there's no way for the CSS or the browser for that matter to figure out which element you're trying to tell him to not style.
See the actuall problem:
Most of inner divs will follow
.XMain div {}
but there are few, which will inherit from other top order element but not .xMain din one,
The cascading effect of .xMain div, is causing problem for this div,
hence I dont want these few to get .xMain div values, but on ther other hand i dont know the css values of these few divs , it will be inherited from some top order element, which i cant decode.
I see. In that case easiest way is still to generate some class for "these few div's" and when you wish to ignore them, you actually overwrite their values (hopefully you know which css properties get changed) by using a more specific selector, using the generated class name ( for example i called it "keepMeOnDefaultStyles").
If that still doesn't work, you'd have to resort to javascript and more specifically the jQuery library, which has a very good support for selectors. You could use that to fix the CSS for those elements. (Also has a good implementation of :not selectors)
I'm running on Win Vista atm, I don't own a Mac, but at home I have a unix machine which can pretty much replicate your computing environment.
Anyway, here's a link about how to use the hasClass method
http://docs.jquery.com/Tra
and the " :not() " selector http://docs.jquery.com/Sel
Explanations should be pretty straight forward and hopefully suit your purpose.
Business Accounts
Answer for Membership
by: thehagmanPosted on 2009-10-28 at 15:11:43ID: 25688853
If you can mark the special divs as
<div class="foo">
then
.xMain div.foo {
float: none;
display: block;
overflow: visible;
}
should set things to default.