473,378 Members | 1,441 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,378 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 16976
*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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.