...

View Full Version : Tables and css Borders



xdous
10-19-2007, 12:33 PM
Hi all.

Im designing a website the html trans way which is consisting of tables and divs.

Im trying to set some css border attributes to a table but it is appling the attributes to all my tables. Iv tried naming the classes different etc but it still applies to all my tables. Any ideas on how i can use the borders for one table?

Cheers :)

Fang
10-19-2007, 12:56 PM
Use id (or class)
<script type="text/javascript">
</script>

<style type="text/css">
#tableborder {border:1px solid #9cf;}

</style>

</head>
<body>
<table id="tableborder" border="0" cellpadding="0" cellspacing="0" summary="">
<tbody>
<tr><td>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</td></tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tbody>
<tr><td>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</td></tr>
</tbody>
</table>
</body>
Tables are for data not layout (http://www.hotdesign.com/seybold/).

xdous
10-19-2007, 01:25 PM
Thanks but i have sorted it now:thumbsup:

VIPStephan
10-19-2007, 02:12 PM
Tables are for data not layout (http://www.hotdesign.com/seybold/).

But also: Part of semantic HTML is to name IDs and classes according to the function of the element, not the alleged look.

Fang
10-19-2007, 02:16 PM
But also: Part of semantic HTML is to name IDs and classes according to the function of the element, not the alleged look.:rolleyes: The example table has no function.

VIPStephan
10-19-2007, 04:12 PM
However, you could still give better examples then by naming it, for example “table1” or something like this. “tableborder” assumes that the table with that ID has or is supposed to have a border which can change if the potential design is changed but the content stays the same (e. g. through a stylesheet switcher).

The important thing is not whether or not your example has a function but rather to give examples that don’t tempt “students” to get off on the wrong foot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum