CSS
Cascading Style Sheets are used to define the presentation layer of websites. How CSS works is not always self-evident, so many of these articles explain various aspects of using CSS.
CSS generated content and screen readers
CSS generated content is announced in some - but not all - screen readers, so use with care.
iOS orientation change and automatic text resizing
There is a clever script that fixes the iOS orientation change zoom bug. Here is a reminder about a couple of issues you may run into when using it.
Automatic line breaks in narrow columns with CSS 3 hyphens and word-wrap
As text columns become narrower, the risk of long words overflowing increases. Luckily you can use the hyphens and word-wrap CSS properties to prevent it.
Use only what you need
Don’t add boilerplate code, polyfills, shivs, frameworks and other things that increase the weight of your site unless you actually need it.
Using max-width on images can make them disappear in IE8
Images that have a CSS max-width, a width attribute in the HTML, and are children of a floated element that has no explicit width set may be invisible in IE8.
Visited links can only be differentiated by colour
It used to be possible to apply any CSS to visited links. This has privacy issues, so most browsers have implemented styling restrictions and only allow colours to be changed.
The difference between width:auto and width:100%
If you’re using width:100% to undo a previously set width on a block level element, you should probably be using width:auto instead. Here’s why.
Styling buttons in iOS WebKit and -webkit-appearance:none
When applying CSS to buttons there are some odd behaviours in WebKit browsers for iOS. Luckily there are at least two ways of working around them.
Screen readers and CSS
Some CSS intended for visual media types only has unexpected and semantic effects on screen readers.
An accessible, keyboard friendly custom select menu
A way of styling the closed state of select elements without sacrificing accessibility.
Using display:table has semantic effects in some screen readers
When you use the table-related display properties of CSS to get the display properties of a table, some screen readers will treat the non-table markup as a real table.
Styling button elements to look like links
In many situations when we tend to use links to trigger actions we should really be using buttons. Here’s how to use real button elements and make them look like links.
Screen readers, list items and list-style:none
Many developers expect screen readers to ignore visual styling of semantic HTML elements. They mostly do, but with list items their behaviour is hit-or-miss.
Line-height in input fields
The Firefox default stylesheet uses the !important keyword when declaring line-height for text inputs. You can’t override this from an author stylesheet, so a workaround is necessary.
Do not use display:none to visually hide content intended for screen readers
Hiding content with display:none hides it from all users, including those who use screen readers. Be aware of this when deciding how to hide content visually.
The Book of CSS3 (Book review)
The Book of CSS3 is a great developer companion - a no-nonsense, well-written guide to the various specifications that make up CSS3.
Adaptive Web Design (Book review)
In this brief and easy-to-read book, Aaron Gustafson does an excellent job of explaining what progressive enhancement is and how to apply it in your daily work.
Responsive Web Design (Book review)
Ethan Marcotte’s book on designing for an ever-increasing variety of browsers, resolutions and screen sizes is a must-read for all web professionals.
Centering button elements and input buttons
Some browsers don’t let you center button elements horizontally by assigning auto margins. Bug or not?
Styling ordered list numbers
How to use generated content to style the numbers of an ordered list separately from the rest of the list item.
Page navigation
Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7 | Page 8 | Page 9 | Page 10 | Page 11 | Page 12 | Page 13 | Page 14 | Page 15 | Page 16 | Page 17 | Page 18 | Page 19 | Page 20 | Page 21Subscribe / follow
Sponsors
Authentic Jobs
- JavaScript/CSS/HTML5 Developer at CurriculaWorks (Burlingame, CA, Ca, US)
- Software Engineer at Avant Credit (Chicago, IL, Il, US)
- Creative Director at LoudDoor (Columbia, SC, So, US)
- UI Designer at charity: water (New York City, Ne, US)
DreamHost web hosting
Use the promo code 456BEREASTREET3 to save USD 20 when you sign up for DreamHost

