Reputation: 3702
<div class="rightsidebox">
<div class="item-info-list">
<p>Model: AIDCU</p>
<div class="product-details">
<p></p>
<div class="price-box"> <span class="regular-price" id="product-price-1617-related">
<span class="price">$8.99</span></span>
</div>
<p></p>
</div>
</div>
I want to make a style for price and make the color green just in a case it is in the rightbox div and I want to use css , I cannot change the structure because it is a theme and it should not have conflict with other prices in other themes
I can use div.rightsidebox>div.item-info-list
but I cannot go further because of the paragraph in there how can I solve it? I have weakness in using ">" and multiple classes in each other
Upvotes: 0
Views: 59
Reputation: 1715
.rightsidebox .price { color: green !important; } // important to override other styles
EDIT: Usage of > - selectorr
The element>element selector is used to select elements with a specific parent. Note: Elements that are not directly a child of the specified parent, are not selected. More info
Upvotes: 0
Reputation: 15860
.rightsidebox .item-info-list p {
/* code */
}
This would go down to the paragraph element inside the classes defined there inside the stylesheet (above off course).
You don't need to be using div.rightsidebox
that is required only if you're having class names for multiple elements. Otherwise only .rightsidebox
is OK.
You can learn more about the CSS child selectors here: https://developer.mozilla.org/en-US/docs/Web/CSS/Child_selectors
Upvotes: 0
Reputation: 278
If you merely just want to select the price
and make it green if it is contained by rightbox:
.rightsidebox .price {
color: green !important;
}
Upvotes: 1
Reputation: 25594
This I believe is what you are looking for:
div.rightsidebox>div.item-info-list>div.product-details {
background:#ff0000;
}
JSFiddle: http://jsfiddle.net/RF5e7/
Upvotes: 2
Reputation:
div.rightsidebox>div.item-info-list .price{
color: green;
}
JSFiddle example.
Upvotes: 0