smashing-ebook-9

Page 150

classes and simpler selectors to cater for those browsers. If not, you can just go crazy!

7. The negation pseudo-class The negation pseudo-class, :not(), lets you target elements that do not match the selector that is represented by its argument. For example, this can be useful if you need to style all the input elements within a form, but you don’t want your input elements with the type submit to be styled — you want them to be styled in a different way —, to look more like buttons: 1 input:not([type="submit"]) { 2 width: 200px; 3 padding: 3px; 4 border: 1px solid #000000; 5 }

Another example: you want all the paragraphs within your post div to have a larger font-size, except for the one that indicates the time and date: 1 .post p:not(.date) { 2 font-size: 13px; 3 }

Can you image the number of possibilities this selector brings with it, and the amount of useless selectors you could strip out off your CSS files were it widely supported?

Smashing eBook #9│Mastering CSS for Web Developers │ 150


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.