why can't I set a tr margin?

Discussion in 'HTML' started by rosdi, Jun 22, 2006.

  1. rosdi

    rosdi Guest

    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>
    rosdi, Jun 22, 2006
    #1
    1. Advertising

  2. rosdi

    Philip Guest

    In article <>,
    "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">
    > <!--
    > 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
    Philip, Jun 22, 2006
    #2
    1. Advertising

  3. rosdi

    rosdi Guest

    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.
    rosdi, Jun 22, 2006
    #3
  4. 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
    David Dorward, Jun 22, 2006
    #4
  5. 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?).
    Harlan Messinger, Jun 22, 2006
    #5
  6. 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!
    Alan J. Flavell, Jun 22, 2006
    #6
  7. rosdi

    rosdi Guest

    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.
    rosdi, Jun 23, 2006
    #7
  8. 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
    David Dorward, Jun 24, 2006
    #8
  9. rosdi

    lalalalala64

    Joined:
    Jun 10, 2011
    Messages:
    2
    useless

    v v v v v v useless
    lalalalala64, Jun 10, 2011
    #9
  10. rosdi

    lalalalala64

    Joined:
    Jun 10, 2011
    Messages:
    2
    lOl @ Alan J. Flavell.. what a gimp
    lalalalala64, Jun 10, 2011
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. f
    Replies:
    5
    Views:
    100,373
    thebeacon
    Jul 16, 2006
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    862
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,762
    Smokey Grindel
    Dec 2, 2006
  4. Cal Who
    Replies:
    1
    Views:
    418
    Alexey Smirnov
    May 16, 2010
  5. Cal Who
    Replies:
    4
    Views:
    566
    Cal Who
    May 17, 2010
Loading...

Share This Page