|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Is this a good way to center a div?
I have been reading alot about how much trouble we get into with IE when trying to center a div. I had a lot of trouble with it and mainly just wanted to have a fixed width site (760px or so) with a thin border all the way around it.
Is the following code a good way to accomplish this? Code:
<head>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
}
div {
border: 1px solid #666666;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div></div></td>
</tr>
</table>
</body>
I am planning on having this as my index page and just using an "include" for the different header/body/footer elements. Would love some advice/opinions. |
|
#2
|
||||
|
||||
|
You should eschew deprecated tags such as center. Try these demos
http://garyblue.port5.com/webdev/vcenter.html http://garyblue.port5.com/webdev/hcenter.html cheers, gary
__________________
There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing. My html and css workshop, demos and tutorials. Ask a better question, get a better answer. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > Is this a good way to center a div? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|