Table Borders - But Only Around The Table!

2 replies
  • WEB DESIGN
  • |
Hi Everyone,

I'd like to add a thin black border around a table but only around it not within it (which happens when the change the html to:
HTML Code:
<table border="1">
.

I tried adding the following to my stylesheet:

Code:
table {
border: 1px solid black;
}
This worked but I have several tables on one page and only want the border around one table how can I achieve this?

Thanks,

Sam

EDIT: I just worked it out.

If your interested I add the following to my stylesheet:

Code:
.table2 {
border: 1px solid black;
}
While I added the following to my HTML page:

HTML Code:
<table class="table2">
instead of
HTML Code:
<table>
Sam
#borders #table
  • Profile picture of the author Walter White
    Thats is the right way to do it! You could also have put the table into another div, but thats not so pretty.
    {{ DiscussionBoard.errors[4031506].message }}
  • Profile picture of the author jakebvs85
    I guess there's nothing wrong with your codes
    {{ DiscussionBoard.errors[6883333].message }}

Trending Topics