HighDots Forums  

margin for <tr> and <td> are not honored

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


Discuss margin for <tr> and <td> are not honored in the Cascading Style Sheets forum.



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

Default margin for <tr> and <td> are not honored - 11-04-2007 , 07:11 AM







I just found that for a table, the margin for <tr> and <td> are not
honored, but the padding is... is this a widely known fact? why make
this an exception for margin, i wonder.


margin not honored:
http://www.0011.com/test_table/index-margin.html

padding honored:
http://www.0011.com/test_table


Reply With Quote
  #2  
Old   
John Hosking
 
Posts: n/a

Default Re: margin for <tr> and <td> are not honored - 11-04-2007 , 10:55 AM






Summercool wrote:
Quote:
I just found that for a table, the margin for <tr> and <td> are not
honored, but the padding is... is this a widely known fact? why make
this an exception for margin, i wonder.
What effect do you want margin on a <tr> to have?

--
John
Pondering the value of the UIP: http://improve-usenet.org/


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

Default Re: margin for <tr> and <td> are not honored - 11-04-2007 , 05:59 PM



In article
<1194181860.757908.296580 (AT) i38g2000prf (DOT) googlegroups.com>,
Summercool <Summercoolness (AT) gmail (DOT) com> wrote:

Quote:
I just found that for a table, the margin for <tr> and <td> are not
honored, but the padding is... is this a widely known fact? why make
this an exception for margin, i wonder.


margin not honored:
http://www.0011.com/test_table/index-margin.html

In general, why would you want to set margin on table cells?
Anyway, you may know that you can make the cells space apart by

<table cellspacing="100" ...> to use your figure.

Put in borders on the cells to test things.

--
dorayme


Reply With Quote
  #4  
Old   
Summercool
 
Posts: n/a

Default Re: margin for <tr> and <td> are not honored - 11-04-2007 , 07:03 PM



On Nov 4, 9:31 am, "Safalra (Stephen Morley)" <use... (AT) safalra (DOT) com>
wrote:
Quote:
On Sun, 04 Nov 2007 13:11:00 -0000, Summercool wrote:
I just found that for a table, the margin for <tr> and <td> are not
honored, but the padding is... is this a widely known fact?

Well it's clearly stated in the specification
(http://www.w3.org/TR/CSS21/box.html#propdef-margin):

'margin'
Value: <margin-width>{1,4} | inherit
Initial: see individual properties
Applies to: all elements except elements with table display types other
than table-caption, table and inline-table
i just thought that every element in CSS can have padding, border, and
margin, as a standard way across all elements...

say... what if my design needs a yellow padding, red border, and then
blue margin? then i can't use margin on a <td> but have to rely on a
<div> to get the job done... ? why not allow <td> to have margin
too?

i can use cellspacing except it is non-CSS and my work place kind of
want everything to be CSS.

by the way, <center> is not HTML 4.01 strict for the reason that
formatting shouldn't be in the doc content but should be in CSS... so
<center> won't pass the W3C validation. however, the cellspacing=100
will pass the W3C validation... isn't the cellspacing also mixing the
formatting in the doc content too and therefore shouldn't pass the
validation?




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

Default Re: margin for <tr> and <td> are not honored - 11-04-2007 , 07:58 PM



In article
<1194224608.674540.132490 (AT) v23g2000prn (DOT) googlegroups.com>,
Summercool <Summercoolness (AT) gmail (DOT) com> wrote:

Quote:
if my design needs a yellow padding, red border, and then
blue margin? then i can't use margin on a <td> but have to rely on a
div> to get the job done... ?
Show us a single real live case where you *have* to have
cellspacing and where padding on the td will not do.

Quote:
i can use cellspacing except it is non-CSS and my work place kind of
want everything to be CSS.

They 'kind of' want this do they? Well, tell them that there are
still a few presentational things left in html which it is ok to
use when there are not other methods at hand.

--
dorayme


Reply With Quote
  #6  
Old   
Summercool
 
Posts: n/a

Default Re: margin for <tr> and <td> are not honored - 11-05-2007 , 01:09 AM



On Nov 4, 5:58 pm, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
Quote:
In article
1194224608.674540.132... (AT) v23g2000prn (DOT) googlegroups.com>,

Summercool <Summercooln... (AT) gmail (DOT) com> wrote:
if my design needs a yellow padding, red border, and then
blue margin? then i can't use margin on a <td> but have to rely on a
div> to get the job done... ?

Show us a single real live case where you *have* to have
cellspacing and where padding on the td will not do.



i can use cellspacing except it is non-CSS and my work place kind of
want everything to be CSS.

They 'kind of' want this do they? Well, tell them that there are
still a few presentational things left in html which it is ok to
use when there are not other methods at hand.

how about for

http://www.0011.com/test_table/index3.html

if i want blue 3px margin surrounding the black dashed border...

hm... a few things left to format in HTML? the thought the idea of
HTML and CSS is to totally separate text and format?




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

Default Re: margin for <tr> and <td> are not honored - 11-05-2007 , 01:21 AM



On Nov 4, 11:09 pm, Summercool <Summercooln... (AT) gmail (DOT) com> wrote:

Quote:
how about for

http://www.0011.com/test_table/index3.html

if i want blue 3px margin surrounding the black dashed border...

hm... a few things left to format in HTML? the thought the idea of
HTML and CSS is to totally separate text and format?
so <div> can do the job...

http://www.0011.com/test_table/index5.html

so margin is just spacing and cannot have graphics or background color
huh? in order to make it have color, you will have to set the
parent's color or set another div to enclose it.




Reply With Quote
  #8  
Old   
John Hosking
 
Posts: n/a

Default Re: margin for <tr> and <td> are not honored - 11-05-2007 , 01:55 AM



Summercool wrote:
Quote:
On Nov 4, 11:09 pm, Summercool wrote:

how about for

http://www.0011.com/test_table/index3.html

if i want blue 3px margin surrounding the black dashed border...

hm... a few things left to format in HTML? the thought the idea of
HTML and CSS is to totally separate text and format?

so <div> can do the job...

http://www.0011.com/test_table/index5.html

so margin is just spacing
....not sure about this revelation...

Quote:
and cannot have graphics or background color
huh? in order to make it have color, you will have to set the
parent's color or set another div to enclose it.
No, consider: td { background-color:#c0c0c0; }

--
John
Pondering the value of the UIP: http://improve-usenet.org/


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

Default Re: margin for <tr> and <td> are not honored - 11-05-2007 , 02:08 AM



In article
<1194246569.339094.51460 (AT) y27g2000pre (DOT) googlegroups.com>,
Summercool <Summercoolness (AT) gmail (DOT) com> wrote:

Quote:
On Nov 4, 5:58 pm, dorayme
Summercool wrote:
if my design needs a yellow padding, red border, and then
blue margin? then i can't use margin on a <td> but have to rely on a
div> to get the job done... ?

Show us a single real live case where you *have* to have
cellspacing and where padding on the td will not do.

i can use cellspacing except it is non-CSS and my work place kind of
want everything to be CSS.

They 'kind of' want this do they? Well, tell them that there are
still a few presentational things left in html which it is ok to
use when there are not other methods at hand.


how about for

http://www.0011.com/test_table/index3.html

if i want blue 3px margin surrounding the black dashed border...

First, you are on a quest or query on how not to use
presentational mark up. You can hive off your border="0" from the
table element to the css. Simply:

table {border:0;}

just as you did for the td

You can also leave it out altogether but never mind this for now.

If you want a blue margin around the table, you would say so in
the css

table {border:3px solid blue;}

and this, in your case, would give you a blue border.

Quote:
hm... a few things left to format in HTML? the thought the idea of
HTML and CSS is to totally separate text and format?
Yes, but nothing is perfect. <g>

I mean, really, css can do so much that the bits and pieces of
presentational that are sometimes useful in html are not a lot to
complain about, surely?

--
dorayme


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

Default Re: margin for <tr> and <td> are not honored - 11-05-2007 , 02:12 AM



In article
<1194247260.657105.29740 (AT) q3g2000prf (DOT) googlegroups.com>,
Summercool <Summercoolness (AT) gmail (DOT) com> wrote:

Quote:
On Nov 4, 11:09 pm, Summercool <Summercooln... (AT) gmail (DOT) com> wrote:

how about for

http://www.0011.com/test_table/index3.html

if i want blue 3px margin surrounding the black dashed border...

hm... a few things left to format in HTML? the thought the idea of
HTML and CSS is to totally separate text and format?

so <div> can do the job...

http://www.0011.com/test_table/index5.html

so margin is just spacing and cannot have graphics or background color
huh? in order to make it have color, you will have to set the
parent's color or set another div to enclose it.
What is it that you are doing, perhaps a more realistic page will
help? You want a background image in the aqua area? Have you
tried? I see no attempts in your code.

--
dorayme


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 - 2008, Jelsoft Enterprises Ltd.