I wrote this css code:
body.product.70 div.mydiv {
display:none
}
and the HTML:
<body class="product 70">
<div class="mydiv">
content
</div>
</body>
But it doesn't want to hide. thanks
I wrote this css code:
body.product.70 div.mydiv {
display:none
}
and the HTML:
<body class="product 70">
<div class="mydiv">
content
</div>
</body>
But it doesn't want to hide. thanks
Well for starters, your class
attribute is missing a closing quote...
EDIT: Aside from that, you're applying two class names, one of which is 70
. This is NOT a valid CSS class name. CSS classes must begin with a hyphen, underscore, or letter.
<body class="product 70">
<div class="mydiv">
content
</div>
</body>
.product .mydiv {
display:none
}
Classes can start with a number, but in order for those classes to be readable, the first number needs to be escaped, which apparently is \3# followed by a space, in this case:
body.product.\37 0 div.mydiv {
display:none
}
Here's the fiddle: http://jsfiddle.net/FaruC/
In CSS1, a class name could start with a digit (".55ft"), unless it was a dimension (".55in"). In CSS2, such classes are parsed as unknown dimensions (to allow for future additions of new units). To make ".55ft" a valid class, CSS2 requires the first digit to be escaped (".\35 5ft") -- http://www.w3.org/TR/CSS21/grammar.html
You don't need to specify too many classes when you call it on css. If you have the class .product for every product, no need to use the class '70' on the css:
body.product {
display:none;
}
I recomend you to use something more semantic html like:
<body>
<div class="product">
<div class="mydiv">
Hello
</div>
</div>
</body>
And finally the css code:
.product{
display:none;
}
I recomend to you that not use only numbers on the classes names. Maybe a single letter followed by a number it'd be more explicative for the developer :)
First of all 70 is not a valid class name.
Instead of giving class to your body. Give it an ID as mentioned here
There are few ways with which you can achieve what you want
directly give the class the attribute of display none
.mydiv{
display:none;
}
Or if you are going to have multiple such class. Specify that only the class within .product class should get this style attribute
.product .mydiv{
display:none;
}
OR
body.product .mydiv{
display:none;
}