Interested in simplifying your life with a visual builder like I mention in the video above? Then checkout Divi theme.
Let’s say you’re starting with a block of text like this and you want to indent it on both sides:
Just put your text into the <p> tags with the style markup as shown below:
<p style="margin-left:10%; margin-right:10%;">This is the text that I want to indent. I want to create a margin on both sides so that it doesn't go the full width of the page. Don't ask me why I want to do this. I just do!</p>
As a result, your text will display like this:
The code above is just a paragraph tag with left and right margins set at 10%. You can change the percentage to any number you want to achieve your desired look. You can also use a number of pixels instead of percentage to set the margins. For example, you can set it to 200px left margin and 50px right margin using this code:
<p style="margin-left:200px; margin-right:50px;">This is the text that I want to indent. I want to create a margin on both sides so that it doesn't go the full width of the page. Don't ask me why I want to do this. I just do!</p>
Then your text would look like the paragraph below. Notice the left margin is much larger since we set it to 200px as opposed to 50px on the right side:
This is a quick and simple method to create indented paragraphs if you only have a few paragraphs to indent. If you are formatting an entire website with many pages of text or you plan on changing the formatting often, it may be more efficient to use CSS styles as described on this tutorial from htmlcodetutorial.com.
Questions? Please comment below…