Posted By

Kerrick on 02/17/12


Tagged

text line justify one


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Kerrick


Justify one line of text in CSS


 / Published in: CSS
 

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

This simply justifies a single line of text via CSS.

  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. }

Report this snippet  

You need to login to post a comment.