View Full Version : How to make table border on one side?
Bengal313
10-22-2003, 01:48 AM
I have table that with a border size of "1". Is there a way to make the border just show on 2 sides?
Example : http://www.msn.com//
***middle of page****
justame
10-22-2003, 04:46 AM
sha...
<table width="200" colspan="2" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2" bgcolor="#000000"><img src="spacer.gif" width="1" height="1" border="0"></td></tr>
<tr><td width="1" bgcolor="#000000"><img src="spacer.gif" width="1" height="1" border="0"></td><td width="199" bgcolor="#ffffff">yadda n' content in just a here®<br><br><br><br><br> aka as the 'text'grows in just a length® here??? that left 'td' will continue to extend its 'darkness' errr table border 'look'...</td></tr></table>
just a goodluck® n' hoping it helps...
ronaldb66
10-22-2003, 07:44 AM
Don't use the border attribute, apply borders through a style sheet. CSS2 offers a great deal of control over table appearance, but I don't know how good browser support is for that; you should be able to go a long way using simple CSS1 borders on individual table cells.
Check out the "HTML & CSS Documentation" sticky at the top for all the necessary background info.
Bengal313
10-22-2003, 09:16 AM
I would like to do that using CSS. Does anyone know how?
ronaldb66
10-22-2003, 01:07 PM
this?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Table with borders</title>
<style type="text/css">
<!--
table {
margin: 0;
padding: 0;
}
td {
width: 5em;
padding: 2px;
border-top: 1px solid black;
border-left: 1px dashed black;
}
-->
</style>
</head>
<body>
<table cellspacing="0">
<tr>
<td>A1</td>
<td>B1</td>
<td>C1</td>
</tr>
<tr>
<td>A2</td>
<td>B2</td>
<td>C2</td>
</tr>
<tr>
<td>A3</td>
<td>B3</td>
<td>C3</td>
</tr>
</body>
</html>
I didn't use CSS2 stuff, just basic CSS1 borders; I don't know if there's a viable CSS property as alternative for the cellspacing attribute, but I thought it wasn't deprecated yet.
Bengal313
10-22-2003, 01:54 PM
Thank you very much. It works great!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.