HTML indentation is achieved through CSS tags or properties that move visual elements away from the edge of their bounding block. CSS is the most widely accepted way to indent HTML, but some formatting statements automatically indent their contents. To indent the first line or an entire block of text, special HTML and CSS code is needed. An HTML hanging indent is the opposite of a standard indent and can be achieved with a negative number for the indentation amount. Indenting an entire block or paragraph can be done with CSS properties or basic HTML tags, but the amount of text to move cannot be explicitly set or controlled.
A HyperText Markup Language (HTML) indentation is a Cascading Style Sheet (CSS) tag or property that causes one or more visual elements on a web page to be moved a certain distance from the edge of its bounding block. The effect of using an HTML indent is the same as using indents in print. The most widely accepted way to indent an HTML document is to use CSS to change the text-indent property of the paragraph containing the text. Some formatting statements, such as lists and quotation marks, automatically indent their contents to differentiate them from the surrounding text. Using CSS to indent HTML only works on the first line of the paragraph and not on an entire block, which can be achieved with various formatting properties.
The way standard HTML operates, multiple spaces and the tab character used on most computers to indent are stripped from files before the code is parsed for display. This means that text that appears formatted in a word processor will not retain that formatting when pasted directly into an HTML document, unless the text is pasted into a WYSIWYG HTML editing program. To indent the first line of a paragraph, or to indent an entire block of text, you need to use special HTML and CSS code.
The text-indent property of block-level elements in CSS will indent the first unformatted element rendered in a block. The return amount must be specified numerically. The option allows the user to specify a number that tells the browser how many pixels, points, centimeters, or other forms of measurement the line should be indented by. This number can also be a percentage of the total block width. This CSS option only works at the block level, indents the first line only, and won’t work on elements that already have some predefined type of formatting behavior, such as bulleted lists.
An HTML hanging indent is the opposite of a standard indent and will pull the first line back by one block so that it appears to the left of the rest of the lines in the paragraph when the text is aligned to read left-to-right. The same text indentation property is used for an HTML hanging indent, except that the number for the indentation amount is negative. This method works only if the margin and border values of a block are large enough to accommodate the hanging indent.
You can define an HTML indentation that moves an entire block or paragraph. This can be done with several block-level CSS properties, including changing the margins or spacing the containing block deeper into a page. It can also be achieved with basic HTML tags like blockquote or pre, which stands for preformatted text. The downside to using base tags to indent HTML is that the amount of text to move cannot be explicitly set or controlled.
Protect your devices with Threat Protection by NordVPN