Padding not working in iE?

I would like to have a space around the content inside the element border.

http://www.w3schools.com/CSS/css_padding.asp

I used cellpadding, which works very well in FF, but not in IE. The version of IE that I am using is 7.0.5730.13

I tried a simple table

<table style="padding:100px" border="1"> <tr><td>123</td></tr> <tr><td>456</td></tr> <tr><td>678</td></tr> <tr><td>kuz</td></tr> </table> 

But there is no way out at all. If I use the padding tag in <td>. It works well. Since padding does not work in IE. I used an alternative method.

I created two dummy lines; one on top, the other below and the dummy columns, one on the right left, and I stylized them with the addition. It works. Please let me know if there is a better way to have a space around the content.

+6
html css internet-explorer
source share
5 answers

http://www.w3schools.com/CSS/css_table.asp
Filling the table is carried out only through the cell (td)

+2
source share

IE does not support table filling. I assume that you want to do this to take place between the edge of the table and the content.

However, you can get the same result by placing the table in a div (this is a cross browser).

 <div style="padding:100px; border: solid black 1px"> <table border="1" style="border: solid transparent 0px; width:100%"> <tr><td>123</td></tr> <tr><td>456</td></tr> <tr><td> 678</td></tr> <tr><td>kzuk</td></tr> </table> </div> 

Div will simulate the outer border of the table.

Edit: This will only work if your table is 100% wide. However, you can limit the width of the div, but then you will need to know how much you want.

 <div style="padding:100px; border: solid black 1px; width:300px"> <table border="1" style="border: solid transparent 0px; width:100%"> <tr><td>123</td></tr> <tr><td>456</td></tr> <tr><td> 678</td></tr> <tr><td>kzuk</td></tr> </table> </div> 
+4
source share

Make sure your tag doesn't work in quircks mode, make sure you put these lines on top of your html:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 

They will prevent, i.e. from quircks boot mode

Remember, if you are applying a table addition, for example

 <table style="padding: 100px"> 

This will leave space between the table and its contents if you want to make space between cells and their contents, similar to vikrash, or you can use cellpadding

+2
source share

You should use something like this:

 <td style="padding: 10px"> 

The CSS style "Padding" should apply to td not to the table.

+1
source share

how about using fields to replace gaskets

 margin: 5px 0 0 5px; 
0
source share

All Articles