Thursday 16 July 2009

css - margin-top not working safari

This was my problem.

I had a table that was using the command 'margin-top' to position itself inside a < div >
It displayed fine in Internet Explorer and Firefox but not in Safari.


my original code was

.module div div div table{
margin-top:45px;
}


I found the solution for this by trial and error.

While testing though I found it helpful to activate the Safari developer tools. You do this by going to ->
Edit->preferences-> then clicking on the tick box for 'Show Develp menu in menubar' at the bottom of the pop-up box.

The solution was to leave the class above blank and target the tbody that lies below the table - ie ->
.module div div div table tbody{
display: block;
margin-top:45px;
}


Please note in your code you may find it easier to just put a class in the table and access it from there, rather than using the tree of < div >s that I have.

No comments: