Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > why can't I set a tr margin?

Reply
Thread Tools

why can't I set a tr margin?

 
 
rosdi
Guest
Posts: n/a
 
      06-22-2006
I tried to separate my table rows a few pixels away from each other,
but my css below doest work, why?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
<!--
tr {
margin-bottom: 15px;
}
-->
</style>
</head>
<body>
<table width="100%">
<tr>
<td>row 1</td>
</tr>
<tr>
<td>row 2</td>
</tr>
</table>
</body>
</html>

 
Reply With Quote
 
 
 
 
Philip
Guest
Posts: n/a
 
      06-22-2006
In article <(E-Mail Removed). com>,
"rosdi" <(E-Mail Removed)> wrote:

> I tried to separate my table rows a few pixels away from each other,
> but my css below doest work, why?
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <style type="text/css">
> <!--
> tr {
> margin-bottom: 15px;
> }
> -->
> </style>
> </head>
> <body>
> <table width="100%">
> <tr>
> <td>row 1</td>
> </tr>
> <tr>
> <td>row 2</td>
> </tr>
> </table>
> </body>
> </html>


Try padding-bottom instead.

A couple of other comments (that you didn't ask for):
- The browsers that got confused if you didn't wrap your CSS in <--
comments --> are long gone. You don't need to do this anymore.
- For most people, XHTML sounds a lot more useful than it actually is.
HTML 4.01 Strict is often a better choice.

HTH

--
Philip
http://NikitaTheSpider.com/
Bulk HTML validation, link checking and more
 
Reply With Quote
 
 
 
 
rosdi
Guest
Posts: n/a
 
      06-22-2006
Philip wrote:
>
> Try padding-bottom instead.
>
> A couple of other comments (that you didn't ask for):
> - The browsers that got confused if you didn't wrap your CSS in <--
> comments --> are long gone. You don't need to do this anymore.
> - For most people, XHTML sounds a lot more useful than it actually is.
> HTML 4.01 Strict is often a better choice.
>
> HTH
>


The reason I didn't use padding-bottom is because I am planning to
display the td border, using padding will make each rows appear fat at
the bottom. So tr really wont work? I am out of luck?

Thanks for the extra comments, will keep it in mind.

 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      06-22-2006
rosdi wrote:

> I tried to separate my table rows a few pixels away from each other,
> but my css below doest work, why?


> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <style type="text/css">
> <!--


Two reasons, first - you commented out your stylesheet. So it will be
ignored (unless you're serving your XHTML as text/html, in which case -
what's the point?).

Second, tables are different when it comes to layout. Try border-spacing
instead.

http://www.w3.org/TR/CSS2/tables.html#separated-borders

I don't think anything exists that will work in MSIE though.


--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
Harlan Messinger
Guest
Posts: n/a
 
      06-22-2006
David Dorward wrote:
> rosdi wrote:
>
>> I tried to separate my table rows a few pixels away from each other,
>> but my css below doest work, why?

>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <style type="text/css">
>> <!--

>
> Two reasons, first - you commented out your stylesheet. So it will be ignored


It won't. <!-- and --> are permitted to appear in CSS but aren't treated
as comment delimiters. This allows the CSS code to be hidden from agents
that don't know what <STYLE> tags are so that they don't treat it as
(bad) HTML.

> (unless you're serving your XHTML as text/html, in which case -
> what's the point?).

 
Reply With Quote
 
Alan J. Flavell
Guest
Posts: n/a
 
      06-22-2006
On Thu, 22 Jun 2006, Harlan Messinger wrote:

> David Dorward wrote: [in reference to XHTML]
> > > <style type="text/css">
> > > <!--

> >
> > Two reasons, first - you commented out your stylesheet. So it will be
> > ignored

>
> It won't.


You evidently don't understand XHTML.

> <!-- and --> are permitted to appear in CSS


XHTML doesn't care in the least what the rules of CSS say. It has to
parse the document according to the rules of XHTML /before/ taking its
decision on what to do with the content - in this case, to pass the
content to CSS - but, by the time it gets that far, there *is* no
content left to be passed on, since it was all commented-out.

> but aren't treated as comment delimiters.


HTML has declared the content of the style and script elements as
CDATA, so that's correct for HTML. But D.D was not talking about
HTML.

If you write XHTML, the rules of HTML are only of indirect interest.

> This allows the CSS code to be hidden from agents that don't know
> what <STYLE> tags are so that they don't treat it as (bad) HTML.


This is pretty much cargo-cult, you know. Pre-HTML/3.2 browsers would
be of little use nowadays anyway (for example, browsers from that era
typically did not support name-based virtual hosts, which makes them
of very limited practical use in today's web situation).

> > (unless you're serving your XHTML as text/html, in which case -
> > what's the point?).


You don't seem to have perceived the significance of what you so
helpfully quoted!
 
Reply With Quote
 
rosdi
Guest
Posts: n/a
 
      06-23-2006

Alan J. Flavell wrote:
> On Thu, 22 Jun 2006, Harlan Messinger wrote:
>
> > David Dorward wrote: [in reference to XHTML]
> > > > <style type="text/css">
> > > > <!--
> > >
> > > Two reasons, first - you commented out your stylesheet. So it will be
> > > ignored

> >
> > It won't.

>
> You evidently don't understand XHTML.
>
> > <!-- and --> are permitted to appear in CSS

>
> XHTML doesn't care in the least what the rules of CSS say. It has to
> parse the document according to the rules of XHTML /before/ taking its
> decision on what to do with the content - in this case, to pass the
> content to CSS - but, by the time it gets that far, there *is* no
> content left to be passed on, since it was all commented-out.
>
> > but aren't treated as comment delimiters.

>
> HTML has declared the content of the style and script elements as
> CDATA, so that's correct for HTML. But D.D was not talking about
> HTML.
>
> If you write XHTML, the rules of HTML are only of indirect interest.
>
> > This allows the CSS code to be hidden from agents that don't know
> > what <STYLE> tags are so that they don't treat it as (bad) HTML.

>
> This is pretty much cargo-cult, you know. Pre-HTML/3.2 browsers would
> be of little use nowadays anyway (for example, browsers from that era
> typically did not support name-based virtual hosts, which makes them
> of very limited practical use in today's web situation).
>


Not trying to interpret the css specification or XHTML rules here. But
the css _IS_ read by IE (or Firefox for that matter). I know this
because some other css in there do take effects. The only problem is tr
{ margin: xx xx} is ignored altogether. Honestly I dont see any reason
why it should be ignored or why tr should be treated any different than
the rest of the elements.

Btw, I will make it a point NOT to comment out my css from now on, I
used to take it for granted because I dont see any ill effect of
commenting it. Probably it has become a bad habit of mine from the
frame and javascript days.

 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      06-24-2006
rosdi wrote:

> Not trying to interpret the css specification or XHTML rules here. But
> the css _IS_ read by IE (or Firefox for that matter).


You snipped the bit about serving XHTML as text/html.


--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
lalalalala64 lalalalala64 is offline
Junior Member
Join Date: Jun 2011
Posts: 2
 
      06-10-2011
v v v v v v useless
 
Reply With Quote
 
lalalalala64 lalalalala64 is offline
Junior Member
Join Date: Jun 2011
Posts: 2
 
      06-10-2011
lOl @ Alan J. Flavell.. what a gimp
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Cisco 2611 and Cisco 1721 : Why , why , why ????? sam@nospam.org Cisco 10 05-01-2005 08:49 AM
Why, why, why??? =?Utf-8?B?VGltOjouLg==?= ASP .Net 6 01-27-2005 03:35 PM
Why Why Why You HAVE NO IDEA MCSE 31 04-24-2004 06:40 PM



Advertisments