Display only the first line of a paragraph using CSS

When you have a long long text and you want to display a portion of it using only css you can code like this:

CSS:

HTML:

 

For Example a Paragraph with a long text:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the

Will be transformed into:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the

Note : You can change the width of the desired text by altering the max-width value

Leave a Comment.