Justify one line of text in CSS


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

This simply justifies a single line of text via CSS.


Copy this code and paste it in your HTML
  1. h2 {
  2. height: 40px; /* Specifying the height and line-height prevents */
  3. line-height: 40px; /* extra space from being added to the bottom. */
  4. text-align: justify;
  5. text-align-last: justify; /* Internet Explorer 6+ */
  6. }
  7.  
  8. h2:after { /* All other browsers */
  9. content: ".";
  10. display: inline-block;
  11. width: 100%;
  12. height: 0;
  13. visibility: hidden;
  14. }

URL: http://kristinlbradley.wordpress.com/2011/09/15/cross-browser-css-justify-last-line-paragraph-text/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.