how to specify background text rectangle color in CSS


Tags: html,css

Problem :

I want to specify background color for HTML using CSS. If my foobar.css file is

back {
  background-color: #808080;
}

and my index.html is

<link href="foobar.css">

<p><back>foo</back></p>
<p><back>foobar</back></p>

then this does not work perfectly: yes the lines have background, but the background only covers the line length, so it is jagged on the right side, and the background does not cover the space between the lines.

How to do it so that the background covers the whole rectangle around the paragraphs?

I tried foobar.css like

table {
  background-color: #808080;
}

and then reference that in index.html like

<table>
<p>foo</p>
<p>foobar</p>
</table>

but this is completely ignored.



Solution :

Hope this solves your isuue

    <table>
        <tr>
            <td>
               <p>foo</p>
               <p>foobar</p>
            </td>
       </tr>
    </table>
  <style>
      table{background-color:red;}
  </style>

    CSS Howto..

    API embeded code is sending