Lesson info

When you want to add long blocks of text to your project, you can use either a paragraph element or a rich text element. In this video, we’ll cover all you need to know about paragraphs: 

  1. ‍Adding paragraphs
  2. ‍Styling paragraphs
  3. ‍Adjusting spacing between paragraphs
  4. ‍Formatting and styling text

Assets

Want to follow along with this lesson? Fortunately, we created a zip file which contains all the assets used in the project, and we've included that link 

right here
.

Transcript

Paragraphs — in many cases — contain most of the text on a given page.

We're gonna cover three aspects of creating and styling paragraphs: adding paragraphs to our project, adjusting spacing between paragraphs, and adding custom styling to our paragraphs.

When we go in and add a paragraph element — when we drag it into our project — it comes with placeholder text. We can double click and type any text we want, or we can paste in a paragraph from an external source.

Now what about something like this: multiple paragraphs. This happens a lot. And it’s a good practice to use a separate paragraph element for each paragraph. Like we have in this section right here. Each paragraph is a separate element. That may seem crazy at first. But a lot of it has to do with our next subject...

...which is adjusting spacing between our paragraphs.

And right here we have a paragraph element with multiple paragraphs inside. We can go in and hit enter a couple times after each of these paragraphs and it creates line breaks. But it's still a single paragraph element. And the challenge is that we don't have any simple way to adjust that spacing.

Now you could be saying: "Wait a second. Can't we hit enter a couple more times? Isn't that technically adjusting the spacing in between paragraphs?" Yes. That's technically adjusting the spacing in between paragraphs. But you're limiting yourself to these giant gaps that don't always look too great.

When you have separate paragraph elements? You can adjust spacing between those elements using margin.

Two ways we're going to cover this:

1. Since we haven't added a class to these paragraphs, their margin can be inherited from the All Paragraphs tag. So all we have to do is go in, and check out All Paragraphs. And we can make changes here like adjusting this margin. Adjusting the breathing room underneath each paragraph. This will change the default margin on paragraphs.

And 2. We can apply a class to our paragraphs to control the styling. Here we're making some changes on this paragraph. At any time, we can double click on that class and rename it (since we intend to reuse it). And once we're done doing that, we can apply it — the class — to other paragraphs. All we have to do is type in that class name, and we can see our styling apply to each paragraph.

That's spacing.

And technically, that's adjusting a style — specifically bottom margin — so let's get right into custom styling for our paragraphs:

Now you can override that default All Paragraphs margin. Create a new class for this paragraph, and we can call it Bigger Paragraph, because that's the plan. And on this class, we can make adjustments to styling so we can achieve the bigger paragraph look we're aiming for.

Once we're done making those style adjustments, if we go to another paragraph, we can add the same class to that, too. And it instantly inherits those styles.

And for more on styling, let's look at some of the inline options we have when we're editing a paragraph.

And if we double-click, and we're editing this paragraph, we can make a selection and apply bold. And we can make another selection and make that italic. And we can grab another one and make that bold and italic. And we can select another chunk and continue to apply styling inline. We can even do a link — just select and insert a link.

The final option when we're editing a paragraph is to wrap text — any text selection — with a span.

Wrap with a span gives us that full flexibility to style only part of our text in any text element. We can have a lot of fun with this. We can change the font itself — maybe we're looking to achieve a code style so we can select something monospace. We can go in and change font color, and make adjustments to all sorts of visual styles here. The point is: as we add and modify these style values, the text is staying inline. And we're only affecting the text we wrapped with a span.

And we can go on and on. We can go in and wrap even more text with a span. And we can style that selection as well. This time, we can create something unique and one-of-a-kind and other terms that mean the same thing.

Now this is an objective truth: our paragraph is a hot mess. We’ve randomly bolded and italicized and styled so much here. It’s nearly illegible. So how do we remove some of the formatting? Well it’s actually just as simple as creating those inline styles and links. Double click to edit the paragraph, make a selection, and clear formatting. It’ll remove what we added to that text. We can also select multiple examples of formatting and clear them all at once using the same method: clear formatting. Or, if we've just had it we can select all, and clear formatting for the entire paragraph. Clear formatting will remove inline styles, spans, and links.

And that's it! We can add paragraphs to our project, create separate elements for each paragraph to control the spacing, and we can style paragraphs to our heart's content.