473,224 Members | 1,476 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,224 software developers and data experts.

Positioning table elements with CSS <div> tags

Hi,

I'm trying to position a <tr> ("row") element with CSS.
The table itself is positioned with <div> tags. The problem is when I
use <div> tags to position the rows within the table nothing happens.

In the following example, I want to position two table rows relative
to the table itself.

Can anyone tell me what I am doing wrong? Please provide sample code.

Thanks

Here is the code:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
<!--
..questionText {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
..instructionText {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
..tableDefault {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000033;
border: 1px solid;
}
-->
</style>
</head>

<body>

<div style="position: absolute; left: 74px; top: 58px; width: 492px;
height: 71px;">
<table width="469" cellpadding="0" cellspacing="1"
class="tableDefault">
<div style="position: relative; left: 100px;">
<tr class="questionText">
<td height="16" colspan="10" valign="top">How satisfied are
you with
the following: </td>
<td width="26"></td>
</tr>
</div>
<div style="position: relative; left: 50px;">
<tr class="instructionText">
<td height="16" colspan="10" valign="top">(fill out
completey)</td>
</tr>
</div>
</table>
</div>

</body>
</html>
Jul 20 '05 #1
7 16965
*Herbman* <hr******@yahoo.com>:

The table itself is positioned with <div> tags.
How do you do that? Usually one would use CSS for that. ;)
when I use <div> tags to position the rows within the table nothing happens.
'Div' isn't allowed inside 'table' nor 'tbody', but 'tr' is. OTOH you can
position /any/ box with CSS, e.g. one generated by an 'tr' element. Your
HTML resp. CSS teachers / books / tutorials should have told you that.
In the following example, I want to position two table rows relative
to the table itself.
Don't margin or padding work better?
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px; font-weight: bold;
font: bold 1em sans-serif;
<style type="text/css">
Why do you use a style element for each ruleset? The 'media' attribute is
useful, but not required.
<div style="position: absolute; left: 74px; top: 58px; width: 492px; height: 71px;">
Better use an ID instead of the 'style' attribute; and on the 'table', not
an extra 'div'.
<table width="469" cellpadding="0" cellspacing="1" class="tableDefault">


Mixing presentational HTML attributes with CSS is hazardous.
These here translate to

table.tableDefault {width: 449px; border-spacing: 1px}
table.tableDefault td {padding: 0}.

--
Useless Fact #5:
'Dreamt' is the only English word that ends in the letters 'mt'.
'I am.' is the shortest complete sentence in the English language.
The longest one-syllable word in the English language is 'screeched.'
Jul 20 '05 #2

"Christoph Paeper" <cr***********@gmx.net> wrote in message
news:bo**********@ariadne.rz.tu-clausthal.de...
*Herbman* <hr******@yahoo.com>:

The table itself is positioned with <div> tags.
How do you do that? Usually one would use CSS for that. ;)
when I use <div> tags to position the rows within the table nothing

happens.
'Div' isn't allowed inside 'table' nor 'tbody',is 'screeched.'


What is wrong with tbody being in a table? Are you sure about that?
If your correct then I'd better not be using thead and tfoot as well!
Can you clarify please
David
Jul 20 '05 #3
"David Graham" <da************@ntlworld.com> wrote in message
news:Rr**************@newsfep1-gui.server.ntli.net...

"Christoph Paeper" <cr***********@gmx.net> wrote in message
news:bo**********@ariadne.rz.tu-clausthal.de...
*Herbman* <hr******@yahoo.com>: 'Div' isn't allowed inside 'table' nor 'tbody',....


What is wrong with tbody being in a table?


I read that as..
'Div' isn't allowed inside 'table' and
'div' isn't allowed inside 'tbody'..

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/
Jul 20 '05 #4
In article David Graham wrote:
'Div' isn't allowed inside ('table' nor 'tbody'),is 'screeched.'

Added parenthesis to group words. Notice that there is no "is" between
"nor" and tbody.
What is wrong with tbody being in a table? Are you sure about that?
Can you clarify please
David

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #5
On Sun, 2 Nov 2003, Andrew Thompson wrote:
"David Graham" <da************@ntlworld.com> wrote in message

"Christoph Paeper" <cr***********@gmx.net> wrote in message

*Herbman* <hr******@yahoo.com>: [nothing that you quoted]
'Div' isn't allowed inside 'table' nor 'tbody',....


What is wrong with tbody being in a table?


I read that as..
'Div' isn't allowed inside 'table' and
'div' isn't allowed inside 'tbody'..


Indeed. More accurately, it "isn't allowed as the immediate
descendent of ...". Wrapped in a table cell, which in turn is wrapped
in a table row, div would be fine.

Jul 20 '05 #6
In article <Pi*******************************@ppepc56.ph.gla. ac.uk>,
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
On Sun, 2 Nov 2003, Andrew Thompson wrote:
"David Graham" <da************@ntlworld.com> wrote in message

"Christoph Paeper" <cr***********@gmx.net> wrote in message

> *Herbman* <hr******@yahoo.com>: [nothing that you quoted]
'Div' isn't allowed inside 'table' nor 'tbody',....

What is wrong with tbody being in a table?


I read that as..
'Div' isn't allowed inside 'table' and
'div' isn't allowed inside 'tbody'..


Indeed. More accurately, it "isn't allowed as the immediate
descendent of ...". Wrapped in a table cell, which in turn is wrapped
in a table row, div would be fine.


"The DIV element in a table is only allowed inside a table cell (TD ot
TH).", that would sum it all up.

--
Kris
kr*******@xs4all.netherlands (nl)
Jul 20 '05 #7
*Andrew Thompson* <an******@bigNOSPAMpond.com>:
"David Graham" <da************@ntlworld.com> wrote in message
"Christoph Paeper" <cr***********@gmx.net> wrote in message

'Div' isn't allowed inside 'table' nor 'tbody',....


What is wrong with tbody being in a table?


I read that as..
'Div' isn't allowed inside 'table' and
'div' isn't allowed inside 'tbody'..


That's how the sentence was meant. The intention to add 'tbody' to the
statement was, that the element is implied in HTML4 (but not in XHTML), i.e.

<table><tr><td>foo</table>

is equal to

<table><tbody><tr><td>foo</td></tr></table>

-- therefore the selector "table>tr" will never match anything in an HTML4
document.

<table><div><tr><td>foo</td></tr></div></table>

could be either

<table><tbody><div><tr><td>foo</td></tr></div></tbody></table>

or

<table><div><tbody><tr><td>foo</td></tr></tbody></div></table>

if it was valid, which it is not.

--
My god lives -- sorry for yours!
Jul 20 '05 #8

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

Similar topics

61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
1
by: Steve Klett | last post by:
Hi- I was just looking at te source for a site that I really liked and I noticed they are using DIV tags where I assumed that would be using a mess of nested tables. Now, this looks like a much...
8
by: localhost | last post by:
I would like to wrap all of the HTML inside of my <body> tag inside a <div> with in my code-behind. I do not want to touch the .aspx page template at all. I know how to make the body tag...
8
by: Patrick | last post by:
Hi you all, I've just downloaded the latest beta of the .Net Framework and Visual Studio Expression 2005 edition. I only created a simple ASPX file with some code-beside/behind (however you want...
9
by: saadkhan | last post by:
I`v made the following code: <div id="Panels" style="width: 28%;"> <asp:Panel ID="one" runat="server" CssClass="Panel"> <div id="Head" onclick="doToggle();"> ...
1
by: saadkhan | last post by:
I`v made the following code: <div id="Panels" style="width: 28%;"> <asp:Panel ID="one" runat="server" CssClass="Panel"> <div id="Head" onclick="doToggle();"> ...
7
by: cmrhema | last post by:
Hi, I have two questions. 1. I have heard that replacing a <tr> <td> with <div> tags increases the rendering speed. Is it so, and if yes which speed does it increase, rendering speed or loading...
10
by: Manikrag | last post by:
Hi Team, I searched a lot on this but could not find anything, so I am posting it here. I am using an AutoCompleteExtender in a user control which is in a master page. The page layout is...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.