html - how to set a table background image


Keywords:html 


Question: 

I am having table and p tag inside div tag with background image. i want to make the background of table and p both transparent so that image appears without boxes. I tried

style="background-color:transparent;"

with p table td tr td tags. but still boxes are appearing. How could I make the whole table and p tag transparent.

here is the image below: That Blue strip below buttons is background image That Blue strip below buttons is background image and following is the css code

div#registration_form
{
    width: 400px;
    border-style: solid;
    text-align: center;
    margin: 50px,auto;
    margin: auto;
}
tr,td,th
{
    padding-top: 5px;
    background-color: transparent;
}
p
{
    background: transparent;
}

4 Answers: 

To get the background color to show through, you need to set background: transparent on a few more items that currently have white backgrounds (form and tbody). Here is the final code to set transparency:

tr,td,th
{
    padding-top: 5px;
    background-color: transparent;
    border:0px;
}
p, form, tbody
{
    background: transparent;
}

And here is the full code and live demo of the result with red background showing through:

div#registration_form {
  width: 400px;
  border-style: solid;
  text-align: center;
  margin: 50px, auto;
  margin: auto;
}
tr,
td,
th {
  padding-top: 5px;
  background-color: transparent;
  border: 0px;
}
p,
form,
tbody {
  background: transparent;
}
* {
  background-color: white;
  font-family: "Comic Sans MS", arial, sans-serif;
  font-size: 16px;
}
a {
  text-decoration: none;
}
input[type="text"],
input[type="password"] {
  background-color: #eeeeee;
  margin-left: 10px;
  font-size: 14px;
  border: none;
  border-radius: 3px;
  color: #888888;
}
input[type="submit"],
input[type="reset"] {
  margin-top: 5px;
  background-color: #008dde;
  color: white;
  margin-bottom: 5px;
  margin-left: 10px;
  border: none;
  border-radius: 3px;
  height: 30px;
}
<div id="registration_form" style="background:red;">
  <form action="RegistrationServlet" method="post">
    <table style="background:transparent;">
      <tr>
        <td>
          First Name
        </td>
        <td>
          <input type="text" id="first_name" name="firstname">
        </td>
      </tr>
      <tr>
        <td>
          Last Name
        </td>
        <td>
          <input type="text" id="last_name" name="lastname">
        </td>
      </tr>
      <tr>
        <td>
          Password
        </td>
        <td>
          <input type="password" id="password" name="password">
        </td>
      </tr>
      <tr>
        <td>
          Confirm Password
        </td>
        <td>
          <input type="password" id="confirm_password" name="confirmpassword">
        </td>
      </tr>
    </table>
    <p>
      <input type="submit" value="Register" id="register">
      <input type="reset" value="Reset" id="reset">
    </p>

  </form>
</div>
 

I am not sure but is this what you want to accomplish ? If it is just add this to your css

tbody {
  background: transparent none repeat scroll 0 0;
}

td {
  color: transparent;
}

form {
  background: transparent none repeat scroll 0 0;
}
 

Your problem is the margin of the p tag, that is a default styling of the paragraphs in html.

Just add this

  p {
    margin: 0;
  }

Red line disappears.

P.D.: I love firefox's inspector :)

 

Hope this will resolve your issue:

Try this:

table*, p{
   background:none transparent;
   border:0px;
}