# HTML: Indenting a paragraph

**URL:** <https://boards.straightdope.com/t/html-indenting-a-paragraph/291333>\
**Category:** Factual Questions\
**Created:** [February 22, 2005, 1:48pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333 "2005-02-22T13:48:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Chance](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/jonathan_chance/32/701_2.png) [@Jonathan\_Chance](https://boards.straightdope.com/u/Jonathan_Chance)\
**Post date:** [February 22, 2005, 1:48pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/1 "2005-02-22T13:48:56Z")

</div>

What the heck is that bit of code for indenting the first line of a paragraph?

It’s like &nbps or something.

Help?

---

<div class="post-metadata">

**Author:** ![slortar](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@slortar](https://boards.straightdope.com/u/slortar)\
**Post date:** [February 22, 2005, 1:51pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/2 "2005-02-22T13:51:52Z")

</div>

It’s &nbsp;.

It’s not really intended for indenting paragraphs, as such. What it does is create a “hard” space. When you indent a paragraph with it, you’re really telling the browser to print a space, one for every &nbsp; you include.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Chance](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/jonathan_chance/32/701_2.png) [@Jonathan\_Chance](https://boards.straightdope.com/u/Jonathan_Chance)\
**Post date:** [February 22, 2005, 2:07pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/3 "2005-02-22T14:07:23Z")

</div>

As may be…it still functions just fine for my purposes!

Thanks, slortar!

---

<div class="post-metadata">

**Author:** ![Catalyst](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Catalyst](https://boards.straightdope.com/u/Catalyst)\
**Post date:** [February 22, 2005, 2:09pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/4 "2005-02-22T14:09:29Z")

</div>

also works, and seems to be preferred by some browsers; I remember nbsp not working on some older versions of Netscape.

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [February 22, 2005, 2:13pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/5 "2005-02-22T14:13:04Z")

</div>

I use a transparent one-pixel gif and just set the width to however many spaces I want for an indent. By setting height you can also use them to space between paragraphs.

---

<div class="post-metadata">

**Author:** ![Catalyst](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Catalyst](https://boards.straightdope.com/u/Catalyst)\
**Post date:** [February 22, 2005, 2:14pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/6 "2005-02-22T14:14:37Z")

</div>

> [@Catalyst](#):
>
> also works, and seems to be preferred by some browsers; I remember nbsp not working on some older versions of Netscape.

Damnable board software! Preview and posting parse these things differently, apparently, so that it shows up in one and not the other. In any event, the code I was referring to was #160. [Here](http://www.w3.org/MarkUp/html-spec/html-spec_13.html) is a complete special character code list.

---

<div class="post-metadata">

**Author:** ![chrisk](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@chrisk](https://boards.straightdope.com/u/chrisk)\
**Post date:** [February 22, 2005, 2:18pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/7 "2005-02-22T14:18:31Z")

</div>

just for the record, the BLOCKQUOTE tag is very useful for indenting a paragraph from the right and left ‘margins’ of the page at the same time. 🙂

---

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [February 22, 2005, 2:21pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/8 "2005-02-22T14:21:08Z")

</div>

You can use an easy inline CSS statement with an HTML \<p\> tag for this as well, and it works more reliably in the sense that it is consistent across platforms.

Example:

```auto

<p style="text-indent: 20pt">Blah blah blah...</p>

```

The above indents exactly 20 points. You can use any of the following units:

Relative:

em (the font height)  
ex (the height of “x”)  
px (number of pixels)

Absolute:

in (inches)  
cm (centimeters)  
mm (milimeters)  
pt (points = 1/72 in)  
pc (picas = 12 pt)

---

<div class="post-metadata">

**Author:** ![micco](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@micco](https://boards.straightdope.com/u/micco)\
**Post date:** [February 22, 2005, 2:21pm UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/9 "2005-02-22T14:21:28Z")

</div>

Using non-breaking spaces or transparent GIFs may give you better support in old browsers, but the preferred way of indenting a paragraph would be to use CSS:  
[http://www.w3c.org/Style/Examples/007/indent.html](http://www.w3c.org/Style/Examples/007/indent.html)

---

<div class="post-metadata">

**Author:** ![Excalibre](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@Excalibre](https://boards.straightdope.com/u/Excalibre)\
**Post date:** [February 28, 2005, 12:31am UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/10 "2005-02-28T00:31:19Z")

</div>

> [@micco](#):
>
> Using non-breaking spaces or transparent GIFs may give you better support in old browsers, but the preferred way of indenting a paragraph would be to use CSS:  
> [CSS: indented paragraphs](http://www.w3c.org/Style/Examples/007/indent.html)

Easier, more reliable (because seriously, is anyone using browsers old enough not to support it anymore?) and most importantly, I can use my user-defined stylesheet to turn it off so I can read the text without it. I really hate indented text on the web - it’s almost as big a crime as justified text, in my book; it looks awful and it exists only to solve a problem that doesn’t exist on the computer screen.

However, my opinions here are irrelevant as the magic of stylesheets means you can indent to your heart’s content, and I won’t have to see it. 🙂

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [February 28, 2005, 1:13am UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/11 "2005-02-28T01:13:13Z")

</div>

[Here’s](http://www.sfwa.org/pubs/ToC-Nebula.html#NAS2004) an example where CSS is used to indent in a way that would look ugly otherwise.

---

<div class="post-metadata">

**Author:** ![rjung](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rjung](https://boards.straightdope.com/u/rjung)\
**Post date:** [February 28, 2005, 6:53am UTC](https://boards.straightdope.com/t/html-indenting-a-paragraph/291333/12 "2005-02-28T06:53:34Z")

</div>

This is 2005; anyone trying to indent a paragraph with non-breaking spaces or transparent GIFs should be flogged. 😉

CSS is Primus’ gift for web designers, folks. Learn it, use it, love it. Visit [The CSS Zen Garden](http://www.csszengarden.com/) if you don’t believe me…
