How to show few lines of text using CSS

How to show few lines of text using CSS
Spread the love

On IndoorGuider.com we are using Simple Author Box plugin. IndoorGuider is a website where you can get guidance on kitchen recipes and kitchen appliances. We are using that Author box plugin to show the author’s bio under all blog posts.

How to show few lines of text using CSS
showing few lines of text using CSS

Why show few lines of text using CSS?

We are using free version of Simple Author Box plugin and they have very limited featured on free version. Also they don’t have such feature where you can show exactly 3 or 4 lines of texts. We had a long description for authors bio but we wanted to show exactly 4 lines of texts in both desktop and mobile responsive.

The CSS code

I applied the CSS code:

 .saboxplugin-wrap .saboxplugin-desc p {
    
   overflow: hidden;
   display: -webkit-box;
   -webkit-line-clamp: 4; /* number of lines to show */
   line-clamp: 4; 
   -webkit-box-orient: vertical;
    
}

With the above code you can apply to any div, just change the class names and it will work.

Let me know in comments if any issues.


Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Most Recent Posts