Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with tables

Status
Not open for further replies.

NickMalloy

Programmer
Apr 15, 2005
68
US
I have a page that looks like the following code. Is there a way to tell the page to put the border around the outside table, but not the inside table?

<div id="righttop">
<table>
stuff here
<table>
stuff here
</table>
stuff here
</table>
</div>


Here are my styles

#righttop {
float: left;
margin-left: 15px;
}

#righttop table {
border: 1px solid #D1D687;
}
 
You would use a child selector for that:
Code:
#righttop>table {
  border: 1px solid #D1D687;
}
However, since there's a pretty popular browser out there which doesn't want to support child selectors, your endeavours will be limited. Therefore, at this time, your best bet is to use class or id.
Code:
#righttop table.first {
  border: 1px solid #D1D687;
}

...

<div id="righttop">
<table class="first">
stuff here
<table>
stuff here
 
Or you can do it like this, without additional classes or things IE doesn't understand:
Code:
#righttop table {
  border: 1px solid #D1D687;
}

#righttop table table {
  border: none;
}
You may find that one or two technically unnecessary classes make it easier to keep track of what's what though.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top