Jef Driesen <je********@hot mail.com.invali d> wrote:
How can I replace/override the table attributes align, border,
cellpadding and cellspacing with css?
align="left" and align="right" are equivalent to float: left; and
float: right; align="center" is equivalent to margin-left: auto;
margin-right: auto; (you must be triggering Standards mode in IE6 for
this last one to work, and it doesn't work at all in IE5).
border is just border. But in CSS the borders on the table and on the
cells are set separately.
cellpaddin is just setting padding on the td and th elements.
cellspacing is border-spacing but hasn't been very well supported in
IE up to now (anyone bothered to check in the IE7 beta yet?) unless
you want to set cellspacing="0" in which case border-collapse:
collapse; has the same effect.
So, something like
<table border="2" cellspacing="2" cellpadding="2" align="center">
would be replicated (with some differnces between browsers) by:
table {
border: 2px outset;
border-spacing: 2px;
border-collapse: separate;
margin-left: auto; margin-right: auto;
}
th, td {
padding: 2px;
border: 1px inset;
}
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>