Hello. I specialize in graphic design and development for web applications.
Everyone who has ever written CSS is familiar with curly brackets and parentheses. Yet surprisingly enough very few even know of a hidden power of CSS, square brackets! Learn more about how to harness this power of PHP and how Microsoft is screwing it up after the jump.
How often do you need to style a text field in a stylesheet? All too often, right? And what’s your usual method? 90% of web designers seem to use the class method - class="text-input" or something similar. It turns out there’s an easier way! The power of square brackets allows you to select text fields with the following line of code: input[type="text"]
There’s a pretty good reason you don’t see square brackets in stylesheets very often and - you guessed it - it’s Microsoft’s fault. Versions of Internet Explorer prior to release 7 don’t support attribute selectors in your CSS in much the same way they don’t support PNG transparency or fixed divs. Take this into account before you start styling your forms using this method. If you’re pressed for time and it wouldn’t look too bad without styles then go ahead and use it. If you want your site to play nice with all browsers then use the old way.
One Response:
Comment by echnar
damn you, internet explorer.
Say your words!