CSS oddities and their fixes


/ Published in: CSS
Save to your folder(s)

Most of these come from the book "CSS Mastery: Advanced Web Standards Solutions," a must-read by Andy Budd (seriously, even if you've used CSS for years, you'll learn a good deal of new things from this book; beginners should read this immediately after learning a bit of CSS).


Copy this code and paste it in your HTML
  1. Never add padding to an element with a defined width due to IE errors. Instead, add padding to the element's children. (Budd page 30)
  2.  
  3. Margin-collapsing only happens with vertical boxes in the normal flow. (Budd 33)
  4.  
  5. Vertical spacing will not affect an inline box, but setting the line-height will. (Budd 33)
  6.  
  7. In IE 5.5 and 6, if you try to set the position of an absolute box relative to a relatively-positioned box, you need to specify the width and height of that relatively-pos. box. (Budd 36)
  8.  
  9. All about clearing on page 41.
  10.  
  11. More to come... Please add your own.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.