We Recommend

CSS: The Definitive Guide CSS: The Definitive Guide
Provides you with a comprehensive guide to CSS implementation, along with a thorough review of all aspects of CSS 2.1. Updated to cover Internet Explorer 7, Microsoft's vastly improved browser, this new edition includes content on positioning, text wrapping (nowrap), lists and generated content, table layout, user interface, paged media, and more.


Posted By

kurai on 09/09/07


Tagged

image align


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

luman
basicmagic
j_junyent


Image Align


Published in: CSS 


Simple CSS to easily align images in blogs and personal sites.

  1. img.centered {
  2. display: block;
  3. margin-left: auto;
  4. margin-right: auto;
  5. }
  6.  
  7. img.alignright {
  8. padding: 4px;
  9. margin: 0 0 2px 7px;
  10. display: inline;
  11. }
  12.  
  13. img.alignleft {
  14. padding: 4px;
  15. margin: 0 7px 2px 0;
  16. display: inline;
  17. }
  18.  
  19. .alignright {
  20. float: right;
  21. }
  22.  
  23. .alignleft {
  24. float: left
  25. }

Report this snippet 

You need to login to post a comment.