There are different methods of indenting text. However, for compatibility with multiple browsers and accessibility, we discuss the popular methods of indenting text on your web page.

For indenting text or a paragraph, the most commonly used and recommended method would be to use CSS. Below are different examples of how CSS can indent text. Each of these examples would be placed between yourHTML tags.

The following example would create a style class named “tab” that indents the text and paragraph 40 pixels from the left.

Once the code above is in thesection, you can use it by adding it to your paragraph (

) tags as shown.

Example of a tab

Including CSS in your HTML document, as shown above, is called “in-line” CSS. It is useful for quickly making changes, but in the long run, it is difficult to change later.

Instead, you can take all your CSS code and place it a separate file, with the extension .css. Then, you can link to this one file from any HTML document, and that document can use those CSS properties. Using an external CSS file make it easier to change the CSS later, because all the CSS is defined in one place.

To link an external CSS file, add the following line in your HTML document in theelement (after thetag, and before thetag). In the following example, we’ve named our .css file basic.css

Once this .css file has is created, edit the file and add the same CSS code, excluding the