I want border around table, tr and td

I'm not understanding why tr behaves differently.  Why doesn't my code give a border around the rows too?  I want a border around the table, tr and td (i.e. 3 levels of borders)

NOTE: My primary objective is not a workaround but to better understand css (i.e. if a workaround is required, I want the workaround in addition to an explanation of why my original code does not work!)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>
   THE TITLE
  </title>
  <style>
table, tr, td
   {
    border: 1px solid black;
   }
   td {
   	font-size: 26px;
   	color:red;
   }
  </style>
 </head>
 <body>
  <table class="property_list">
   <tr class="property_list_row">
    <td>1</td>
    <td>1</td>
    <td>1</td>
    <td>1</td>
   </tr>
   <tr>
    <td>2</td>
    <td>2</td>
    <td>2</td>
    <td>2</td>
   </tr>  </table>
 </body>
</html>

Open in new window

SAbboushiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
As the other question the TR tag does not have a css attribute of border
http://www.w3schools.com/tags/tag_tr.asp
FF and others respect it but IE does not (correctly so), so you have to use the border-collapse hack to make IE see it as a dimensionable object.
0
SAbboushiAuthor Commented:
>> the TR tag does not have a css attribute of border
But neither does the TD tag
http://www.w3schools.com/tags/tag_td.asp

So this doesn't explain to me why it works with TD but not TR
0
GaryCommented:
The TR tag is a semantic tag meaning it isn't an element - in other words it doesn't really exist except as a visual aid and to separate TD's. It has no height or width meaning it cannot have a border.
The TD tag is a real element so can have CSS styling

I cannot find a definitive link describing this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

SAbboushiAuthor Commented:
K thanks for your help.  So is there a way to get the 3 levels of borders?
0
GaryCommented:
What do you mean 3 levels?
0
SAbboushiAuthor Commented:
I want a border around the table, tr and td (i.e. 3 levels of borders)
0
GaryCommented:
You cannot, the most you could have is 2 borders, the TR border would become the TD border.
0
SAbboushiAuthor Commented:
k thanks-
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.