Adding a Google Font

Problem

You want to insert a Google Font into your website without uploading the font files

Solution #1

Add to your page template:

@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');

(replace “Montserrat” with font name)

 

Solution #2

Add to your stylesheet:

@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');

(replace “Montserrat” with font name)

Truncating Text Using CSS

The Problem

You have an area of text that needs to automatically truncate to fit the space.

Solution #1: Single Line Text

p {
max-width: 150px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}

Solution #2: Multiple Lines of Text

p {
line-height: 2rem;
max-height: 8rem;
-webkit-box-orient: vertical;
display: block;
display: -webkit-box;
overflow: hidden !important;
text-overflow: ellipsis;
-webkit-line-clamp: 4;
}