|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Centering a table with CSS
I'm trying to center a table with CSS, because apparently putting align="center" in the table tag doesn't validate as HTML Strict.
I've tried table.center { position: fixed; left: 50%; } but that makes the table go off of the page. I've tried all the options given on w3schools.com with their positioning lessons, but none of them work. Any suggestions? |
|
#2
|
||||
|
||||
|
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="EN" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta name="Author" content="Jamie Burns" />
<meta name="Description" content="" />
<meta name="Keywords" content="" />
<title></title>
<style type="text/css" title="centering">
html, body {
margin-left: auto;
margin-right: auto;
}
#centeredtable {
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<table id="centeredtable" style="border: 1px groove #000">
<tr>
<td>This is a test</td>
</tr>
</table>
</body>
</html>
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. ![]() __________________ |
|
#3
|
|||
|
|||
|
Thanks a lot, it worked.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > Centering a table with CSS |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|