Vertical align type with image


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

A replacement for now deprecated align attribute:


Copy this code and paste it in your HTML
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
  2. <html>
  3. <head>
  4. <title>Vertical align type with image</title>
  5. <style>
  6.  
  7. p a {
  8. border: 1px solid #ccc;
  9. display: block;
  10. font-family: helvetica, arial, sans serif;
  11. font-size: 0.5em;
  12. }
  13.  
  14. img.alignment {
  15. vertical-align: middle;
  16. }
  17.  
  18. img.icon {
  19. width: 25px;
  20. height: 25px;
  21. margin-right: 5px;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <p>
  27. <a href="#"><img class="alignment icon" src="images/twitter.png" alt="icon">Follow us on Twitter!</a>
  28. </p>
  29. </body>
  30. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.