473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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>DataList Position</title>
<style type="text/css">
cControl {position:inherit; 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>

Jul 20 '05 #1
14 21865
From: 6.**********@spamgourmet.com
(Zenobia)
Hello folks,
Is it possible to position an item within a
<td> element?


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

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!!!

Jul 20 '05 #2
Zenobia <6.**********@spamgourmet.com> wrote:
Is it possible to position an item within a <td> element?
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).
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.
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.
I can't use 2 or more <td> elements as the <td> is put there
using an ASP.NET repeater control
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.
- 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.
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.
cControl {position:inherit; left:600px; text-align:right;
float:right}
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.
<p>
What's the point of this empty paragraph? If you want to add space
above the table set margin-top.
<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>


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 <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3
On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DL**@webtv.net> wrote:
From: 6.**********@spamgourmet.com
(Zenobia)
Hello folks,
Is it possible to position an item within a
<td> element?
<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.
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!!!


Oh my.
Jul 20 '05 #4
"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DL**@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.


It may be deprecated, but it is still supported, and is essential for NN4
support.
Jul 20 '05 #5

From: ne*****@yahoo.com (Neal)
On Mon, 14 Jun 2004 13:07:24 -0400,
Davmagic .Com <DL**@webtv.net>
wrote: From: 6.**********@spamgourmet.com
(Zenobia)
Hello folks,
Is it possible to position an item within a
<td> element?
<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.


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

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!!!

Jul 20 '05 #6
DU
Steve Pugh wrote:
Zenobia <6.**********@spamgourmet.com> wrote:

Is it possible to position an item within a <td> element?

Yes. Set position: relative; for the <td>


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; and whichever of left, right, top and bottom you need for the child
element.
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 concerning posititioning relative to table cells).

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.

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.


Exactly. My point.

http://www10.brinkster.com/doctorunc...ormatting.html
I can't use 2 or more <td> elements as the <td> is put there
using an ASP.NET repeater control

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.

- 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.

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.

cControl {position:inherit; left:600px; text-align:right;
float:right}

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.

<p>

What's the point of this empty paragraph? If you want to add space
above the table set margin-top.

<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>

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


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
Jul 20 '05 #7
Zenobia wrote:
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.


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)
http://www.tsmchughs.com/
Jul 20 '05 #8
DU
Davmagic .Com wrote:
From: ne*****@yahoo.com (Neal)
On Mon, 14 Jun 2004 13:07:24 -0400,
Davmagic .Com <DL**@webtv.net>
wrote:

From: 6.**********@spamgourmet.com
(Zenobia)
Hello folks,
Is it possible to position an item within a
<td> element?

<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.

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


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
Jul 20 '05 #9
On Mon, 14 Jun 2004 23:21:43 GMT, C A Upsdell
<cupsdell0311XXX@-@-@XXXrogers.com> wrote:
"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DL**@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.


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


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.

Jul 20 '05 #10
"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Mon, 14 Jun 2004 23:21:43 GMT, C A Upsdell
<cupsdell0311XXX@-@-@XXXrogers.com> wrote:
"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DL**@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.


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


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.


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.


Jul 20 '05 #11
DU
C A Upsdell wrote:
"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Mon, 14 Jun 2004 13:07:24 -0400, Davmagic .Com <DL**@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.

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

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

http://www.westciv.com/style_master/...port/text.html

http://devedge.netscape.com/library/...astergrid.html
(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
Jul 20 '05 #12
"Zenobia" <6.**********@spamgourmet.com> schrieb im Newsbeitrag
news:0f********************************@4ax.com...

[...]
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.


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
Jul 20 '05 #13
On Mon, 14 Jun 2004 18:12:52 +0100, Steve Pugh <st***@pugh.net>
wrote:
Zenobia <6.**********@spamgourmet.com> wrote:
Is it possible to position an item within a <td> element?
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).
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.


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.


Thanks Steve. Your reply was most helpful. This worked. Your
solution without the td class.
<html>
<head><title>DataList 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>
Steve


Jul 20 '05 #14
On Mon, 14 Jun 2004 13:07:24 -0400, DL**@webtv.net (Davmagic
..Com) wrote:
From: 6.**********@spamgourmet.com
(Zenobia)
Hello folks,
Is it possible to position an item within a
<td> element?
<td align="right"> ...use center or left also...</td>


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>?"
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!!!


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.

Jul 20 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matt Adams | last post by:
I want to move the following <PRE> defintion to a css file: <TABLE><TR><TD><PRE>sample text</PRE></TD> <TD> not predefined font</TD></TR></TABLE> should be <TABLE><TR><TD class=aaa>sample...
3
by: Gil | last post by:
Hello, I use VB.NET and have a series of linkbuttons that are inside individual <td>s. Like this: <td background="image.gif"><asp:linkbutton id="myID" runat="server"/></td> I would like...
3
by: RC | last post by:
I have a very sime html table like <html><head><title>My Table</title> <style> input { margin: 0; padding: 0; border-width: 0; text-indet: 0; text-align: left } </style></head><body> <table...
5
by: Magnus Blomberg | last post by:
Hello! I have a table with several rows with text. I want to make the complete cell (or row) clickable as a link/href. Writing <a href...><td>bla bla</td></a> is not possible. If this is...
2
by: taras.di | last post by:
Hi everyone, I know that there's been a bit of discussion involving placing <div>s inside table cells, but I've read all of the posts and couldn't find anything that solved my problem. I've...
3
by: workingstiff19 | last post by:
First, I'm glad to find a newsgroup that still uses a FAQ: http://www.htmlhelp.com/faq The challenge: These checkboxes (inside a table data TD tag) came out too squeezed together (vertically)...
9
by: Lloyd Sheen | last post by:
I have now spent the entire morning on what I think should be easy. I cannot for the life of me figure out how to make a simple one row, two column table where is the contents of the one of the...
3
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/td-position.html In Internet Explorer, the "hello, world!" text is on top on the red box is on the bottom. In Firefox, the "hello, world!" text is on...
0
by: Peter Boritz | last post by:
I am new to Tidy and am using the .Net version. Tidy is picking up <span> tags nested inside of <td>. These are the result of Microsoft Clipboard GetData(HTML) which does a pretty sloppy job in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.