ETpro
12-27-2011, 02:46 AM
This CSS works, and drills down to the image I want to style.
#itemtype .itemform .price-bold img, #itemtype .itemform .price img,
#itemtype .itemform .sale-price-bold img, #itemtype .itemform .sale-price img,
#contents .price-bold img, #contents .price img, #contents .sale-price img {
vertical-align: middle;
margin-left: 10px;
}
Back End SCRIPTING tests whether items are on sale or not, and whether the store owner wants pricing displayed in bold or not, and uses a series of conditionals to decide which class; price, price-bold or sale-price, to assign to a given price display.
Of course, I could just assign a class to the image itself, but I'm looking at this as a learning opportunity. I have to style lots of HTML that is generated by CGI scripts I do not have access too. And so I often have to use long-chain specifiers to single out a particular HTML element I want to style when there are dozens of such elements here and there on a page. Long-chains of specifiers work to do that. So I'd like to know if there is a simple way I could have shortened the above and still styled all those IMG tags without touching any others.
#itemtype .itemform .price-bold img, #itemtype .itemform .price img,
#itemtype .itemform .sale-price-bold img, #itemtype .itemform .sale-price img,
#contents .price-bold img, #contents .price img, #contents .sale-price img {
vertical-align: middle;
margin-left: 10px;
}
Back End SCRIPTING tests whether items are on sale or not, and whether the store owner wants pricing displayed in bold or not, and uses a series of conditionals to decide which class; price, price-bold or sale-price, to assign to a given price display.
Of course, I could just assign a class to the image itself, but I'm looking at this as a learning opportunity. I have to style lots of HTML that is generated by CGI scripts I do not have access too. And so I often have to use long-chain specifiers to single out a particular HTML element I want to style when there are dozens of such elements here and there on a page. Long-chains of specifiers work to do that. So I'd like to know if there is a simple way I could have shortened the above and still styled all those IMG tags without touching any others.