How to Indent Every Line Except the First Using HTML and CSS

Learn how to indent every line but the first in your text using simple HTML and CSS techniques for better formatting.

98 views

To indent every line but the first, you can use a combination of HTML and CSS. Wrap the text in a `<div>` with a class name, then define the class in CSS to apply the desired indentation:** ```html <div class="indent"> First line text<br> Second line text<br> Third line text </div> <style> .indent { text-indent: 0; } .indent br + br { text-indent: 1em; } </style> ```

FAQs & Answers

  1. What CSS property is used to indent text? The CSS property 'text-indent' is used to control the indentation of the first line of text in an element.
  2. Can CSS indent every line except the first one? Yes, by using a combination of CSS selectors and HTML structure, you can simulate indenting every line except the first.
  3. How do I apply a hanging indent using CSS? A hanging indent can be applied by setting 'text-indent: -1em' and padding or margin-left of '1em' on a block of text.