Indenting a Paragraph with only Inline CSS

Bipolar Tangerine picture Bipolar Tangerine · Dec 17, 2013 · Viewed 8.5k times · Source

Going to forego all the background to my problem and just present it:

I need to get CSS to indent paragraphs for me, but I can only use inline CSS. Using the p {text-indent:15px;} (or whatever number I need) doesn't work. The text box is basically just BBCode, but I can use inline CSS, provide that I use the BBCode that will enable it. This means I can't have the code at the top (can't remember what this is called), nor can I reference an external style sheet.

When I use just the code for text-indent:15px;, it only indents the first line of whatever I've typed, even if there are several breaks in it (hitting enter twice, I mean, like I do here). I don't have the option to keep opening/closing this code (person the code is for can't understand coding at all), and I didn't know if there's a way to do this, or if I should tell them that they're doomed to not indenting their text?

[css=background:black; width:500px; margin-left:50px; color:maroon; font-size:12px;][css=padding:5px 25px;]YOUR TEXT SHOULD GO HERE.
[color=white]Your links should be this color.[/color]
[/css][/css]

That's what I can write. If I want a link to be a different color than the rest of the text, I have no way to format the links, and I have to use BBCode to change the color every time. By using the text-indent property, it'll indent the first line of my text (as it should), and nothing else. Period. Since I'm operating with BBCode and can't use HTML to open/close paragraphs, using the code that operate based off of the paragraph tag (<p>) achieves nothing.

Answer

punund picture punund · Dec 17, 2013

p is a flow element, and text-indent exactly indents first line. Make it a block and use padding:

p.yourclass
  { display: inline-block
  ; padding-left: 15px
  }