Add a background color to text, but with space blank space between lines of paragraph
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-03-27T01:17:56Z
Indexed on
2010/03/27
1:23 UTC
Read the original article
Hit count: 486
css
Hi,
I was wondering if something was possible to do in CSS. Basically i want to recreate the text on the RHS of the image using html/css, but currently I'm getting the LHS of the image.
The HTML:
<div id="banner">
<div id="text">
<p>This is an example of what I have</p>
</div>
</div>
The CSS:
div#banner { background: green; width:300px; height:300px;}
div#text { margin: 20px auto; }
div#text p { background:#fff; padding: 5px; margin: 5px; font-size: 2em; }
Now I realise that this can be done already either by:
- Using an image
- Using separate p tags
(By Point 2 I mean:
<div id="banner">
<div id="text">
<p>This is an</p>
<p>example of</p>
<p>what I have</p>
</div>
</div>
)
But what I would really like to know is if it's actually possible to do what is on the RHS of the image, using only css and a single p tag?
© Stack Overflow or respective owner