 |
 |
CSS background colors in paragraphs
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Netherlands
Status:
Offline
|
|
I would like to know how I could use background color in paragraphs (headings, lists, p) and to have the background color connected without whitespace between different paragraphs. Is this possible?
Here is an example:
<font face = "courier">
Styles:
body { background-color: white; }
p { background-color: green; }
HTML:
<p> paragraph 1 </p>
<p> paragraph 2 </p>
</font>
|
|
"Chance is irrelevant. We will succeed."
== 7 of 9 ==
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
Originally posted by ervier:
<STRONG>I would like to know how I could use background color in paragraphs (headings, lists, p) and to have the background color connected without whitespace between different paragraphs. Is this possible?
Here is an example:
<font face = "courier">
Styles:
body { background-color: white; }
p { background-color: green; }
HTML:
<p> paragraph 1 </p>
<p> paragraph 2 </p>
</font></STRONG>
put the paragraphs in a table and make the td background what you wanted to make your p background.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Netherlands
Status:
Offline
|
|
Originally posted by Raman:
<STRONG>put the paragraphs in a table and make the td background what you wanted to make your p background.</STRONG>
Raman,
I know this solution, and have used it, and should have made it clear that I did, but I want to know whether there is one without using a table.
|
|
"Chance is irrelevant. We will succeed."
== 7 of 9 ==
|
| |
|
|
|
 |
|
 |
|
Administrator 
Join Date: Mar 2000
Location: Land of the Easily Amused
Status:
Offline
|
|
another way is this:
if your text is 11, then use a line height of 12 or less.
<font face = "courier">font-size : 11px; line-height : 12px;</font>
that should make for a solid color over the text without spaces in-between the lines. you could also draw boxes using stylesheets, but i wouldn't recommend it.
[ 12-11-2001: Message edited by: Demonhood ]
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Netherlands
Status:
Offline
|
|
Originally posted by Demonhood:
<STRONG>another way is this:
if your text is 11, then use a line height of 12 or less.
</STRONG>
Thanks for the tip, but I found a better way when trying yours. Accidentally I had margins set for this heading, and the whitespace was still there. Then I removed the margins, but the whitespace became bigger. So then I set top- and bottom-margins to 0px, et voila! Just what I wanted! 
|
|
"Chance is irrelevant. We will succeed."
== 7 of 9 ==
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Nov 1999
Status:
Offline
|
|
That technique works, but it can also make your text look somewhat jammed together. So you may want to adjust the top and bottom padding on your paragraphs to compensate. That should get some space between them again.
|
|
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|