HighDots Forums  

Table border and CSS

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Table border and CSS in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gianni
 
Posts: n/a

Default Table border and CSS - 07-02-2009 , 10:42 PM






If I do:

<table border="1">

I get a border.

I have three of four different tables.
I would like to set them up without
border="1":

<table>

and use css to turn the border on
or off. Is it possible?

Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: Table border and CSS - 07-02-2009 , 11:00 PM






In article <h2jr7r$6kj$1 (AT) aioe (DOT) org>, Gianni <gianni (AT) gianni (DOT) com> wrote:

Quote:
If I do:

table border="1"

I get a border.

I have three of four different tables.
I would like to set them up without
border="1":

table

and use css to turn the border on
or off. Is it possible?
Yes.

<table class="bestBuys">
<table class="planets">
<table class="topEconomies">

and in the CSS, one way to target the ones that you want a border for
might be:

..planets {border: 1px solid #000}

The others will be borderless by default.

If you want the cells themselves to have borders, one way is no border
to table itself but:

table {border-collapse: collapse}
td {border: 1px solid #000;}

--
dorayme

Reply With Quote
  #3  
Old   
Gianni
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 11:03 AM



dorayme wrote:
Quote:
In article <h2jr7r$6kj$1 (AT) aioe (DOT) org>, Gianni <gianni (AT) gianni (DOT) com> wrote:

If I do:

table border="1"

I get a border.

I have three of four different tables.
I would like to set them up without
border="1":

table

and use css to turn the border on
or off. Is it possible?

Yes.

table class="bestBuys"
table class="planets"
table class="topEconomies"

and in the CSS, one way to target the ones that you want a border for
might be:

.planets {border: 1px solid #000}

The others will be borderless by default.

If you want the cells themselves to have borders, one way is no border
to table itself but:

table {border-collapse: collapse}
td {border: 1px solid #000;}

Thank you.
Your suggestions work exactly what I was
looking for.

Reply With Quote
  #4  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 01:11 PM



dorayme wrote:

Quote:
table border="1"
- -
.planets {border: 1px solid #000}
That sets a border around the whole table only, which is different from the
effect of the HTML attribute.

Quote:
If you want the cells themselves to have borders, one way is no border
to table itself but:

table {border-collapse: collapse}
td {border: 1px solid #000;}
This generates yet another type of bordering. Quite possibly better than the
HTML way, but nominally the OP asked for a replacement of <table
border="1">. There is no replacement, as the effect of the HTML construct
depends on the browser in a manner that cannot (and probably need not) be
reproduced in CSS.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Reply With Quote
  #5  
Old   
Ben C
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 01:37 PM



On 2009-07-03, Jukka K. Korpela <jkorpela (AT) cs (DOT) tut.fi> wrote:
Quote:
dorayme wrote:

table border="1"
- -
.planets {border: 1px solid #000}

That sets a border around the whole table only, which is different from the
effect of the HTML attribute.

If you want the cells themselves to have borders, one way is no border
to table itself but:

table {border-collapse: collapse}
td {border: 1px solid #000;}

This generates yet another type of bordering. Quite possibly better than the
HTML way, but nominally the OP asked for a replacement of <table
border="1">. There is no replacement, as the effect of the HTML construct
depends on the browser in a manner that cannot (and probably need not) be
reproduced in CSS.
What can you do with the border attribute that you can't do with CSS?

Reply With Quote
  #6  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 01:46 PM



Ben C wrote:

Quote:
What can you do with the border attribute that you can't do with CSS?
What I said - generate borders in browser-dependent, undocumented manner.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Reply With Quote
  #7  
Old   
jeff
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 02:08 PM



Jukka K. Korpela wrote:
Quote:
Ben C wrote:

What can you do with the border attribute that you can't do with CSS?

What I said - generate borders in browser-dependent, undocumented manner.

I think Yukka must be working from an undisclosed location. When do
we get to see the undocumented behaviour of <table border="1"> ?

Jeff

Reply With Quote
  #8  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 02:31 PM



Biff wrote:

Quote:
I think Yukka must be working from an undisclosed location.
Try using my real name or my nickname, not a spelling you invented, and
maybe I'll stop calling you Biff.

Quote:
When do
we get to see the undocumented behaviour of <table border="1"> ?
As soon as you bother testing the effect of that construct on some browsers,
I guess.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Reply With Quote
  #9  
Old   
jeff
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 02:37 PM



Jukka K. Korpela wrote:
Quote:
Biff wrote:

I think Yukka must be working from an undisclosed location.

Try using my real name or my nickname, not a spelling you invented, and
maybe I'll stop calling you Biff.
Maybe you should look at your own sig line:

Yucca, http://www.cs.tut.fi/~jkorpela/

Since English is not your native spelling how the hell was I supposed
to know that you didn't want to use *your* signature. I've seen it for
years.
Quote:
When do
we get to see the undocumented behaviour of <table border="1"> ?

As soon as you bother testing the effect of that construct on some
browsers, I guess.
Same old Jukka.


Jeff
>

Reply With Quote
  #10  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Table border and CSS - 07-03-2009 , 03:04 PM



Biff wrote:

Quote:
Jukka K. Korpela wrote:
Biff wrote:

I think Yukka must be working from an undisclosed location.

Try using my real name or my nickname, not a spelling you invented,
and maybe I'll stop calling you Biff.

Maybe you should look at your own sig line:

Yucca, http://www.cs.tut.fi/~jkorpela/
And where do you see the name you used?

As you are not paying attention and you are posting messages with no
on-topic content, and as you avoid the on-topic point I made, you get close
to ranking as a nuisance.

ObCSS: Note that CSS specifications do not in any way define _how_ the
presentational HTML markup that might be "honored" is to be interpreted in
CSS terms.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.