quick (and dumb) CSS question

Status
Not open for further replies.

greatoz

Ars Tribunus Militum
2,847
Subscriptor++
never mind - got around it:

code:<HR>
Code:
/* tables */<P>.title-table{background: "#666666"}
.nav-table{background: "#cccccc"}<P>/* general */
.title{font-family: Verdana, Arial, sans-serif;color: white;font-size:40px;font-weight:normal;margin:2px;}
.navlink{font-family: Verdana, Arial, sans-serif;color: black;font-size:12px;font-weight:normal;margin:0px;}

and

code:<HR>
Code:
<table width="95%" border="0" cellspacing="4" cellpadding="2">
<tr>
<td div class="title-table" height="100" align="right" valign="bottom"></div><div class="title">
b o l a n d e r . n e t  </div>    
</td>
</tr>
<tr>
<td div class="nav-table " height="20"></div><div class="navlink">

wait - does ths mean I actually fixed some code!?!?!?! w00t! :D

tGo
 

dnl2ba

Ars Legatus Legionis
18,025
Subscriptor
<tt>align</tt> and <tt>valign</tt>? Are you kidding me? :D <tt>text-align</tt> and <tt>vertical-align</tt>, respectively, will assail what ails ya.

If you don't have anything else in that title cell, well, you might as well consolidate. Watch what this does to your HTML!

code:<HR>
Code:
table.title {
  width: 95%;
  padding: 0;
}<P>td.nav {
 background-color: #cccccc;
 color: black;
 font-family: Verdana, Arial, sans-serif;
 font-size: 100%;
 height: 20px;
 margin: 0px;
}<P>td.titlecell {
  background-color: #666666;
  color: white;
  font-family: Verdana, Arial, sans-serif;
  font-size: 140%;  /* Relative font sizes == teh good, unless it absolutely must fit into some fixed-size layout. */
  height: 100px;
  letter-spacing: .2em;  /* This is so you don't have to do silly stuff like manual spaces between letters. */
  margin: 2px;
  text-align: right;
  vertical-align: bottom;
}

The corresponding HTML would be:

code:<HR>
Code:
<table cellspacing=4 class=title>
<tr>
<td class=titlecell>bolander.net</td>
</tr>
<tr>
<td class=nav>some nav stuff</td>
</tr>
</table>

(Neither changing the CSS properties of <tt>margin</tt> nor of <tt>padding</tt> seems to do what changing <tt>cellspacing</tt> does, so I guess I don't yet know how to eliminate that ugly hunk of HTML.)
 

Greg Hines

Ars Tribunus Militum
1,686
Subscriptor++
dnl2ba:

Try

Code:
TD {
    border-spacing: 2px 4px;
}

Where <code>2px</code> is the vertical spacing and <code>4px</code> is the horizontal spacing. That would be like having <code>cellspacing="2"</code> for the vertical values and <code>cellspacing="4"</code> for the horizontal values. Note: only the <code><table></code> and <code><td></code> elements may use the border-spacing attribute.

About the only problem with it is poor browser support. IE5.x/Win is the only pre-v6 browser to implement it, but even its implementation is buggy. IE6's implementation is better, though.
 
Status
Not open for further replies.