Cool CSS way to make left- or right-aligned (but not "styled" or "classed") images look pretty with no HTML change.

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

When we can't or won't change the code of image tag with align attribute, but no 'style="margin: 0 10px 10px 0;' or 'hspace=10px' (IMHO, hspace makes bad looking layout in most cases) code within (just pure code), we can use simple CSS rules for such an images to make them good looking.

Copy this code and paste it in your HTML
  1. CSS code:
  3. img[align="left"]{ margin-right: 10px; margin-bottom: 10px; }
  5. img[align="right"]{ margin-left: 10px; margin-bottom: 10px; }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.