Most recent post
How to proportionally scale images that have dimension attributes
Allowing images to scale along with their container is an important part of responsive web design (and was so even before the term “responsive web design” existed). It’s really quite easy – all you need to do is give the image a width (or max-width) in percent:
img {
max-width:100%;
}
This will prevent any img element from getting wider than its container. If the container is narrower than the image, the image will scale down. But there is a catch.
Slightly older posts
Firefox and the magical text-overflow:ellipsis z-index
If you start seeing mysterious dots rendered on top of positioned elements in Firefox, check your text-overflow and z-index properties.
Replacing images when printing
Sometimes you want to use different images when viewing a web page on screen and when printing it. One way of doing that is to use CSS generated content.
Using a transparent image as an icon fallback
When you use an icon or other graphic instead of text for buttons, make sure there is real text for users who cannot see the image.
Conditional sibling class names for IE patching
A different approach to using conditional comments to add class names for targeting CSS at different versions of Internet Explorer.
Responsive drop shadows
A few examples of how you can create a non-rectangular drop shadow that will adapt to the width of the element it is applied to.
Letting users disable responsive layout
If you need to give users the choice to disable responsive layout, here is one way of implementing a switch to toggle it off and on.
How to shrinkwrap and center elements horizontally
When you need to center a floated element horizontally you can't say "float:center", but fortunately there are several other ways of solving the problem.
Subscribe / follow
Sponsors
Authentic Jobs
- Engagement Manager at Mutual Mobile (Austin, TX, Te, US)
- Creative Director at Revision3, A Discovery Digital Network (San Francisco, Ca, US)
- User Experience Lead at Mutual Mobile (Austin, TX, Te, US)
- Web QA Automation Engineer at SnapApp (Watertown, MA, Ma, US)
DreamHost web hosting
Use the promo code 456BEREASTREET3 to save USD 20 when you sign up for DreamHost

