Wordpress Align


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

How to align floating images in wordpress posts and add captions.


Copy this code and paste it in your HTML
  1. img.alignleft, div.alignleft {
  2. float:left;
  3. margin:0 0.5em 0.5em 0;
  4. }
  5.  
  6. img.alignright, div.alignright {
  7. float:right;
  8. margin:0 0 0.5em 0.5em;
  9. }
  10.  
  11. img.aligncentered, div.aligncentered {
  12. display: block;
  13. text-align:center;
  14. margin:0 auto;
  15. }
  16.  
  17. .wp-caption {
  18. border: 1px solid #ddd;
  19. text-align: center;
  20. background-color: #f3f3f3;
  21. padding-top: 4px;
  22. margin: 10px;
  23. -moz-border-radius: 3px;
  24. -khtml-border-radius: 3px;
  25. -webkit-border-radius: 3px;
  26. border-radius: 3px;
  27. }
  28.  
  29. .wp-caption img {
  30. margin: 0;
  31. padding: 0;
  32. border: 0 none;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.