Can I position items inside a <td>?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zenobia

    #1

    Can I position items inside a <td>?

    Hello folks,

    Is it possible to position an item within a <td> element? For
    instance see below. The table has multiple rows, one for each
    database record. Each row has 3 hrefs associated with it (for
    edit, delete and update). I want to position these 3 href items
    in the same columns, which would be posible if the span could be
    positioned - for instance on the extreme right of the td in
    which it is contained.

    I can't use 2 or more <td> elements as the <td> is put there
    using an ASP.NET repeater control - so unless there is an
    equivalent of this control using <div> and <span> that is not
    possible.

    Somehow, I anticipate that the answer will be to use a different
    ASP.NET control. Don't bother posting a reply if that is the
    case.

    ++++++++++
    <html>
    <head><title>Da taList Position</title>
    <style type="text/css">
    cControl {position:inher it; left:600px; text-align:right;
    float:right}
    </style>
    </head>
    <body>
    <p>
    <table>
    <tr>
    <td> -- Content --
    <span class="cControl ">
    <a href="href A">E</a>
    <a href="href B">D</a>
    <a href="href C">U</a>
    </span>
    </td>
    </tr>
    <tr>
    <td> -- Some other Content --
    <span class="cControl ">
    <a href="href A">E</a>
    <a href="href B">D</a>
    <a href="href C">U</a>
    </span>
    </td>
    </tr>
    </table>
    </body>
    </html>

  • Davmagic .Com

    #2
    Re: Can I position items inside a &lt;td&gt;?

    [color=blue]
    >From: 6.20.zenobia@sp amgourmet.com
    >(Zenobia)
    >Hello folks,
    >Is it possible to position an item within a
    ><td> element?[/color]

    <td align="right"> ...use center or left also...</td>

    Web Design, Magic, Painting, Junking, More
    Used & Antique Furniture For Sale In Metro Detroit Michigan No Shipping Available!

    Paint A House

    NOTE: This emailbox is CLOSED do NOT reply!!!

    Comment

    • Steve Pugh

      #3
      Re: Can I position items inside a &lt;td&gt;?

      Zenobia <6.20.zenobia@s pamgourmet.com> wrote:
      [color=blue]
      >Is it possible to position an item within a <td> element?[/color]

      Yes. Set position: relative; for the <td> and then position: absolute;
      and whichever of left, right, top and bottom you need for the child
      element. However beware of bugs (IIRC Mozilla has a nasty one
      concerning posititioning relative to table cells).
      [color=blue]
      >For
      >instance see below. The table has multiple rows, one for each
      >database record. Each row has 3 hrefs associated with it (for
      >edit, delete and update). I want to position these 3 href items
      >in the same columns, which would be posible if the span could be
      >positioned - for instance on the extreme right of the td in
      >which it is contained.[/color]

      Sure.
      td {position: relative;}
      span {position: absolute; right: 0;}

      But from the sound of it just adding text-align: right; or
      align="right" for the td will work just as well in this case.
      [color=blue]
      >I can't use 2 or more <td> elements as the <td> is put there
      >using an ASP.NET repeater control[/color]

      Sounds like ASP.NET is seriously broken if it won't let you insert
      three coloumns instead of one. I don't believe that it is seriously
      broken (well not that seriously broken) so I guess that the mistake is
      either your choice of control or your implementation of it.
      [color=blue]
      >- so unless there is an
      >equivalent of this control using <div> and <span> that is not
      >possible.
      >
      >Somehow, I anticipate that the answer will be to use a different
      >ASP.NET control. Don't bother posting a reply if that is the
      >case.[/color]

      Tough. People will post what people want to post. And if people think
      taht you're being an arse by using a defective ASP.NET control then
      they'll tell you that.
      [color=blue]
      > cControl {position:inher it; left:600px; text-align:right;
      >float:right}[/color]

      Well, in the absence of a URL we'll have to assume that this is your
      entire stylesheet. In which case it's 75% useless. position: inherit;
      in the absence of a parent element with position set is going to work
      out as position: static; which means that left: 600px; will be
      ignored. text-align doesn't apply to inline elements like spans, but
      float right makes it a block element. However no width is specified so
      many (but not all) browsers will shrink the element to fit round the
      content so the text-align is once again useless.
      [color=blue]
      ><p>[/color]

      What's the point of this empty paragraph? If you want to add space
      above the table set margin-top.
      [color=blue]
      ><table>
      > <tr>
      > <td> -- Content --
      > <span class="cControl ">
      > <a href="href A">E</a>
      > <a href="href B">D</a>
      > <a href="href C">U</a>
      > </span>
      > </td>[/color]

      Well the span should be floated to the right from your CSS. Isn't that
      what you wanted? If you wanted the span to be alongside your other
      content then you should have place the span first.

      Steve

      --
      "My theories appal you, my heresies outrage you,
      I never answer letters and you don't like my tie." - The Doctor

      Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

      Comment

      • Neal

        #4
        Re: Can I position items inside a &lt;td&gt;?

        On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DLSD@webtv.net > wrote:
        [color=blue]
        >[color=green]
        >> From: 6.20.zenobia@sp amgourmet.com
        >> (Zenobia)
        >> Hello folks,
        >> Is it possible to position an item within a
        >> <td> element?[/color]
        >
        > <td align="right"> ...use center or left also...</td>[/color]

        Except in up-to-date HTMl the align attribute is deprecated. Don't advise
        this method, please.
        [color=blue]
        > Web Design, Magic, Painting, Junking, More
        > http://www.davmagic.com
        > Paint A House
        > http://www.paintahouse.com
        > NOTE: This emailbox is CLOSED do NOT reply!!![/color]

        Oh my.

        Comment

        • C A Upsdell

          #5
          Re: Can I position items inside a &lt;td&gt;?

          "Neal" <neal413@yahoo. com> wrote in message
          news:opr9lpy0gy 6v6656@news.ind ividual.net...[color=blue]
          > On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DLSD@webtv.net > wrote:[color=green]
          > > <td align="right"> ...use center or left also...</td>[/color]
          >
          > Except in up-to-date HTMl the align attribute is deprecated. Don't advise
          > this method, please.[/color]

          It may be deprecated, but it is still supported, and is essential for NN4
          support.


          Comment

          • Davmagic .Com

            #6
            Re: Can I position items inside a &lt;td&gt;?


            From: neal413@yahoo.c om (Neal)[color=blue]
            >On Mon, 14 Jun 2004 13:07:24 -0400,
            >Davmagic .Com <DLSD@webtv.net >
            >wrote:[/color]
            [color=blue]
            >From: 6.20.zenobia@sp amgourmet.com
            >(Zenobia)
            >Hello folks,
            >Is it possible to position an item within a
            ><td> element?[/color]
            [color=blue][color=green]
            >><td align="right"> ...use center or left
            >>also...</td>[/color][/color]
            [color=blue]
            >Except in up-to-date HTMl the align
            >attribute is deprecated. Don't advise this
            >method, please.[/color]

            "Oh my"... pretty please with sugar on it?

            Web Design, Magic, Painting, Junking, More
            Used & Antique Furniture For Sale In Metro Detroit Michigan No Shipping Available!

            Paint A House

            NOTE: This emailbox is CLOSED do NOT reply!!!

            Comment

            • DU

              #7
              Re: Can I position items inside a &lt;td&gt;?

              Steve Pugh wrote:[color=blue]
              > Zenobia <6.20.zenobia@s pamgourmet.com> wrote:
              >
              >[color=green]
              >>Is it possible to position an item within a <td> element?[/color]
              >
              >
              > Yes. Set position: relative; for the <td>[/color]

              That would make the <td> be offset and a <td> is not just an ordinary
              block-level element here but a part, a child of a special block-level
              element.

              and then position: absolute;[color=blue]
              > and whichever of left, right, top and bottom you need for the child
              > element.[/color]

              Why not just set text-align: right of the content of the <td> instead?
              W3C CSS2 and CSS2.1 recommends against setting absolute and relatively
              positioned elements within a table cell.
              Section 17.5 of CSS 2/2.1


              However beware of bugs (IIRC Mozilla has a nasty one[color=blue]
              > concerning posititioning relative to table cells).
              >
              >[color=green]
              >>For
              >>instance see below. The table has multiple rows, one for each
              >>database record. Each row has 3 hrefs associated with it (for
              >>edit, delete and update). I want to position these 3 href items
              >>in the same columns, which would be posible if the span could be
              >>positioned - for instance on the extreme right of the td in
              >>which it is contained.[/color]
              >
              >
              > Sure.
              > td {position: relative;}
              > span {position: absolute; right: 0;}
              >
              > But from the sound of it just adding text-align: right; or
              > align="right" for the td will work just as well in this case.
              >[/color]

              Exactly. My point.




              [color=blue]
              >[color=green]
              >>I can't use 2 or more <td> elements as the <td> is put there
              >>using an ASP.NET repeater control[/color]
              >
              >
              > Sounds like ASP.NET is seriously broken if it won't let you insert
              > three coloumns instead of one. I don't believe that it is seriously
              > broken (well not that seriously broken) so I guess that the mistake is
              > either your choice of control or your implementation of it.
              >
              >[color=green]
              >>- so unless there is an
              >>equivalent of this control using <div> and <span> that is not
              >>possible.
              >>
              >>Somehow, I anticipate that the answer will be to use a different
              >>ASP.NET control. Don't bother posting a reply if that is the
              >>case.[/color]
              >
              >
              > Tough. People will post what people want to post. And if people think
              > taht you're being an arse by using a defective ASP.NET control then
              > they'll tell you that.
              >
              >[color=green]
              >> cControl {position:inher it; left:600px; text-align:right;
              >>float:right }[/color]
              >
              >
              > Well, in the absence of a URL we'll have to assume that this is your
              > entire stylesheet. In which case it's 75% useless. position: inherit;
              > in the absence of a parent element with position set is going to work
              > out as position: static; which means that left: 600px; will be
              > ignored. text-align doesn't apply to inline elements like spans, but
              > float right makes it a block element. However no width is specified so
              > many (but not all) browsers will shrink the element to fit round the
              > content so the text-align is once again useless.
              >
              >[color=green]
              >><p>[/color]
              >
              >
              > What's the point of this empty paragraph? If you want to add space
              > above the table set margin-top.
              >
              >[color=green]
              >><table>
              >> <tr>
              >> <td> -- Content --
              >> <span class="cControl ">
              >> <a href="href A">E</a>
              >> <a href="href B">D</a>
              >> <a href="href C">U</a>
              >> </span>
              >> </td>[/color]
              >
              >
              > Well the span should be floated to the right from your CSS. Isn't that
              > what you wanted? If you wanted the span to be alongside your other
              > content then you should have place the span first.
              >
              > Steve
              >[/color]

              From the beginning of the original post, I am convinced that such fine
              formating of a table cell content implies table-design for the page,
              certainly not formating for tabular data within a table. So, the whole
              discussion is most likely flawed.

              DU

              Comment

              • Brian

                #8
                Re: Can I position items inside a &lt;td&gt;?

                Zenobia wrote:
                [color=blue]
                > Somehow, I anticipate that the answer will be to use a different
                > ASP.NET control. Don't bother posting a reply if that is the case.[/color]

                If you don't want us to respond, I'm happy to oblige. However,
                curiousity compels me to ask why you posted in the first place.

                --
                Brian (remove ".invalid" to email me)

                Comment

                • DU

                  #9
                  Re: Can I position items inside a &lt;td&gt;?

                  Davmagic .Com wrote:
                  [color=blue]
                  > From: neal413@yahoo.c om (Neal)
                  >[color=green]
                  >>On Mon, 14 Jun 2004 13:07:24 -0400,
                  >>Davmagic .Com <DLSD@webtv.net >
                  >>wrote:[/color]
                  >
                  >
                  >[color=green]
                  >>From: 6.20.zenobia@sp amgourmet.com
                  >>(Zenobia)
                  >>Hello folks,
                  >>Is it possible to position an item within a
                  >><td> element?[/color]
                  >
                  >
                  >[color=green][color=darkred]
                  >>><td align="right"> ...use center or left
                  >>>also...</td>[/color][/color]
                  >
                  >
                  >[color=green]
                  >>Except in up-to-date HTMl the align
                  >>attribute is deprecated. Don't advise this
                  >>method, please.[/color]
                  >
                  >
                  > "Oh my"... pretty please with sugar on it?
                  >[/color]

                  Are you suggesting that the align attribute for <td> is not deprecated
                  or are you insinuating that CSS1 text-align property is not well
                  supported by a very wide majority of web browsers in use on the web?

                  DU

                  Comment

                  • Neal

                    #10
                    Re: Can I position items inside a &lt;td&gt;?

                    On Mon, 14 Jun 2004 23:21:43 GMT, C A Upsdell
                    <cupsdell0311XX X@-@-@XXXrogers.com> wrote:
                    [color=blue]
                    > "Neal" <neal413@yahoo. com> wrote in message
                    > news:opr9lpy0gy 6v6656@news.ind ividual.net...[color=green]
                    >> On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DLSD@webtv.net >
                    >> wrote:[color=darkred]
                    >> > <td align="right"> ...use center or left also...</td>[/color]
                    >>
                    >> Except in up-to-date HTMl the align attribute is deprecated. Don't
                    >> advise
                    >> this method, please.[/color]
                    >
                    > It may be deprecated, but it is still supported, and is essential for NN4
                    > support.[/color]

                    In the context of this ng - being www authoring - support for NN4 is not
                    really practical. I assume unless otherwise prompted that the main goal is
                    good markup for *current* browsers. As it's trivial to serve content to
                    NN4 without (optional) presentation, I don't see any reason to offer the
                    align attribute as blanket advice for a presentational situation.

                    Comment

                    • C A Upsdell

                      #11
                      Re: Can I position items inside a &lt;td&gt;?

                      "Neal" <neal413@yahoo. com> wrote in message
                      news:opr9l5e9ve 6v6656@news.ind ividual.net...[color=blue]
                      > On Mon, 14 Jun 2004 23:21:43 GMT, C A Upsdell
                      > <cupsdell0311XX X@-@-@XXXrogers.com> wrote:
                      >[color=green]
                      > > "Neal" <neal413@yahoo. com> wrote in message
                      > > news:opr9lpy0gy 6v6656@news.ind ividual.net...[color=darkred]
                      > >> On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DLSD@webtv.net >
                      > >> wrote:
                      > >> > <td align="right"> ...use center or left also...</td>
                      > >>
                      > >> Except in up-to-date HTMl the align attribute is deprecated. Don't
                      > >> advise
                      > >> this method, please.[/color]
                      > >
                      > > It may be deprecated, but it is still supported, and is essential for[/color][/color]
                      NN4[color=blue][color=green]
                      > > support.[/color]
                      >
                      > In the context of this ng - being www authoring - support for NN4 is not
                      > really practical. I assume unless otherwise prompted that the main goal is
                      > good markup for *current* browsers. As it's trivial to serve content to
                      > NN4 without (optional) presentation, I don't see any reason to offer the
                      > align attribute as blanket advice for a presentational situation.[/color]

                      Stats vary, but on my site 1.2% use NN4. I dumped NN4 long ago, but am not
                      yet ready to dump my NN4 visitors.

                      You have a point, however, when you say "I don't see any reason to offer the
                      align attribute as blanket advice for a presentational situation". Perhaps
                      the best advice would have been to present the CSS solution, and then add
                      what is required for NN4 for those sites which still attract a significant
                      number of NN4 users.




                      Comment

                      • DU

                        #12
                        Re: Can I position items inside a &lt;td&gt;?

                        C A Upsdell wrote:[color=blue]
                        > "Neal" <neal413@yahoo. com> wrote in message
                        > news:opr9lpy0gy 6v6656@news.ind ividual.net...
                        >[color=green]
                        >>On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DLSD@webtv.net > wrote:
                        >>[color=darkred]
                        >>><td align="right"> ...use center or left also...</td>[/color]
                        >>
                        >>Except in up-to-date HTMl the align attribute is deprecated. Don't advise
                        >>this method, please.[/color]
                        >
                        >
                        > It may be deprecated, but it is still supported, and is essential for NN4
                        > support.
                        >
                        >[/color]


                        NS 4.x supports CSS1 text-align property according to these sources




                        (see section 5.4.6)

                        and to Top Style software (see CSS safe list and NS 4 CSS support).

                        In any cases, what matters is graceful degradation for non-CSS-compliant
                        browsers. If content is accessible, then support for this or that css
                        property should not the decisive issue.

                        DU

                        Comment

                        • Markus Ernst

                          #13
                          Re: Can I position items inside a &lt;td&gt;?

                          "Zenobia" <6.20.zenobia@s pamgourmet.com> schrieb im Newsbeitrag
                          news:0flrc0tg0c mj3h5rblpqejrhp lg9bkalp6@4ax.c om...

                          [...]
                          [color=blue]
                          > Somehow, I anticipate that the answer will be to use a different
                          > ASP.NET control. Don't bother posting a reply if that is the
                          > case.[/color]

                          Do you allow me to post a reply if I think you should consider switching to
                          PHP if ASP.NET makes it impossible to use 3 separate tds?

                          Seriously: After having had a very short introduction into ASP.NET I doubt
                          that it is a problem to use 3 tds, one for each link. For sure it will be
                          easier than figuring out a cross browser working positioning hack.

                          --
                          Markus


                          Comment

                          • Zenobia

                            #14
                            Re: Can I position items inside a &lt;td&gt;?

                            On Mon, 14 Jun 2004 18:12:52 +0100, Steve Pugh <steve@pugh.net >
                            wrote:
                            [color=blue]
                            >Zenobia <6.20.zenobia@s pamgourmet.com> wrote:
                            >[color=green]
                            >>Is it possible to position an item within a <td> element?[/color]
                            >
                            >Yes. Set position: relative; for the <td> and then position: absolute;
                            >and whichever of left, right, top and bottom you need for the child
                            >element. However beware of bugs (IIRC Mozilla has a nasty one
                            >concerning posititioning relative to table cells).
                            >[color=green]
                            >>For
                            >>instance see below. The table has multiple rows, one for each
                            >>database record. Each row has 3 hrefs associated with it (for
                            >>edit, delete and update). I want to position these 3 href items
                            >>in the same columns, which would be posible if the span could be
                            >>positioned - for instance on the extreme right of the td in
                            >>which it is contained.[/color]
                            >
                            >Sure.
                            >td {position: relative;}
                            >span {position: absolute; right: 0;}
                            >
                            >But from the sound of it just adding text-align: right; or
                            >align="right " for the td will work just as well in this case.[/color]

                            Thanks Steve. Your reply was most helpful. This worked. Your
                            solution without the td class.


                            <html>
                            <head><title>Da taList Position</title>
                            <style type="text/css">
                            .cControl {position: absolute; right: 0}
                            </style>
                            </head>
                            <body>
                            <table>
                            <tr>
                            <td> -- Content --
                            <span class="cControl ">
                            <a href="href A">E</a>
                            <a href="href B">D</a>
                            <a href="href C">U</a>
                            </span>
                            </td>
                            </tr>
                            <tr>
                            <td> -- Some other Content --
                            <span class="cControl ">
                            <a href="href A">E</a>
                            <a href="href B">D</a>
                            <a href="href C">U</a>
                            </span>
                            </td>
                            </tr>
                            </table>
                            </body>
                            </html>
                            [color=blue]
                            > Steve[/color]

                            Comment

                            • Zenobia

                              #15
                              Re: Can I position items inside a &lt;td&gt;?

                              On Mon, 14 Jun 2004 13:07:24 -0400, DLSD@webtv.net (Davmagic
                              ..Com) wrote:
                              [color=blue]
                              >[color=green]
                              >>From: 6.20.zenobia@sp amgourmet.com
                              >>(Zenobia)
                              >>Hello folks,
                              >>Is it possible to position an item within a
                              >><td> element?[/color]
                              >
                              ><td align="right"> ...use center or left also...</td>[/color]

                              Thanks but no thanks. Given that everyone's having a go a me
                              for suggesting they shouldn't waste time replying if they have
                              no relevant comments - I'll have a go at you.

                              Please read the question in future before replying. The td cell
                              has two items of content. The first needs to be aligned left and
                              the second aligned right. The simplest solution is given below.
                              Your solution won't work. The clue is in the question "items
                              inside a <td>?" not just "text inside a <td>?"
                              [color=blue]
                              >Web Design, Magic, Painting, Junking, More
                              >http://www.davmagic.com
                              >Paint A House
                              >http://www.paintahouse.com
                              >NOTE: This emailbox is CLOSED do NOT reply!!![/color]

                              I wish I could recommend spamgourmet as a solution to spam but
                              the spam keeps coming now that I'm giving people a box to reply
                              to. At least the viruses have stopped.

                              Comment

                              Working...