473,583 Members | 4,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>Untitl ed 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">
<!--
..instructionTe xt {
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="tableDef ault">
<div style="position : relative; left: 100px;">
<tr class="question Text">
<td height="16" colspan="10" valign="top">Ho w satisfied are
you with
the following: </td>
<td width="26"></td>
</tr>
</div>
<div style="position : relative; left: 50px;">
<tr class="instruct ionText">
<td height="16" colspan="10" valign="top">(f ill out
completey)</td>
</tr>
</div>
</table>
</div>

</body>
</html>
Jul 20 '05 #1
7 16991
*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="tableDef ault">


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

table.tableDefa ult {width: 449px; border-spacing: 1px}
table.tableDefa ult 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.t u-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.t u-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*******@xs4al l.netherlands (nl)
Jul 20 '05 #7
*Andrew Thompson* <an******@bigNO SPAMpond.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><tb ody><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
24437
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 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
1
1331
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 cleaner way to do things. My question, as an absolute newbie to <div> tags is can you access them anyway like you can access a placeholder? I...
8
4844
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 runat=server and give it an id so I can find it from the code-behind, but after that I want to add the <div>. One problem I see is that I just add the <div> to...
8
1428
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 to call it). First thing I checked was the generated html-output and I was shocked! I found <div>-tags everywhere .... what are they for? which w3c...
9
20170
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();"> HEADER </div> </asp:Panel> <asp:Panel ID="two" runat="server" CssClass="Content"> ...
1
1840
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();"> HEADER </div> </asp:Panel> <asp:Panel ID="two" runat="server" CssClass="Content"> ...
7
7995
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 speed. 2. Is the main purpose of app_browser is to convert <tr><td> to <div> tags.
10
5362
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 designed byDIV tags. My code in that user control is somehting like.. ---------------------------- <DIV> <asp:ScriptManager ID="ScriptManager1"...
1
7933
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8191
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6578
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5700
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5372
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3816
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1155
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.