473,698 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to do a <table> with <div> tag

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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>

Anyone?

TIA,
Toby Austin
Jul 20 '05 #1
61 24477
bo************* *@hotmail.com (Toby Austin) wrote:
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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>


Show us what you are actually trying to do (using real content).

--
Spartanicus
Jul 20 '05 #2
bo************* *@hotmail.com (Toby Austin) wrote:
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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>


Show us what you are actually trying to do (using real content).

--
Spartanicus
Jul 20 '05 #3
Toby Austin wrote:
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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>


2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position: absolute }. It
has { width: 300px }.

Let the "content" just flow into position without positioning it. Don't set a
width.

Give the "content" a { margin-right: 310px }. Its stuff will then stay clear
of the sidebar.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #4
Toby Austin wrote:
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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>


2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position: absolute }. It
has { width: 300px }.

Let the "content" just flow into position without positioning it. Don't set a
width.

Give the "content" a { margin-right: 310px }. Its stuff will then stay clear
of the sidebar.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #5
Barry Pearson ne**@childsuppo rtanalysis.co.u k wrote:
Toby Austin wrote:
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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>


2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position: absolute }. It
has { width: 300px }.

Let the "content" just flow into position without positioning it. Don't set a
width.

Give the "content" a { margin-right: 310px }. Its stuff will then stay clear
of the sidebar.


however...there is generally no point attempting to recreate an old table
layout using css...why not create a new layout that uses the strengths of
css rather than use it to imitate the strengths of tables?

--
eric
www.ericjarvis.co.uk
"live fast, die only if strictly necessary"
Jul 20 '05 #6
Barry Pearson ne**@childsuppo rtanalysis.co.u k wrote:
Toby Austin wrote:
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%">so me data that will 'stretch'</td>
<td valign="top" width="300">som e data that won't 'stetch'</td>
</tr>
</table>


2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position: absolute }. It
has { width: 300px }.

Let the "content" just flow into position without positioning it. Don't set a
width.

Give the "content" a { margin-right: 310px }. Its stuff will then stay clear
of the sidebar.


however...there is generally no point attempting to recreate an old table
layout using css...why not create a new layout that uses the strengths of
css rather than use it to imitate the strengths of tables?

--
eric
www.ericjarvis.co.uk
"live fast, die only if strictly necessary"
Jul 20 '05 #7
Eric Jarvis wrote:
Barry Pearson ne**@childsuppo rtanalysis.co.u k wrote:
Toby Austin wrote:
> 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.
[snip] 2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position:
absolute }. It has { width: 300px }.

Let the "content" just flow into position without positioning it.
Don't set a width.

Give the "content" a { margin-right: 310px }. Its stuff will then
stay clear of the sidebar.


however...there is generally no point attempting to recreate an old
table layout using css...why not create a new layout that uses the
strengths of css rather than use it to imitate the strengths of
tables?


The OP simply wanted to put 2 lots of stuff side-by-side. That is sensible in
lots of cases. For example, it is a way of enabling the user to see the main
content & supplementary information in the viewport without (vertical)
scrolling between them.

I suspect that the original table was simply an attempt to achieve this layout
concept. Now, the OP wants to do it without tables. But the layout concept
remains valid.

Columns are very important. They enable the user, within seconds, to identify
where all the most important parts of the page are. And then to get to all of
them with just vertical scolling, for which there are various mechnical aids.
(I use a cordless batteryless mouse with a scroll-wheel).

The point is *not* to use the strengths of CSS! It is to achieve the objective
of communicating with the audience. And that may well be achieved with
side-by-side columns, that can jointly be accessed via vertical scrolling.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #8
Eric Jarvis wrote:
Barry Pearson ne**@childsuppo rtanalysis.co.u k wrote:
Toby Austin wrote:
> 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.
[snip] 2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position:
absolute }. It has { width: 300px }.

Let the "content" just flow into position without positioning it.
Don't set a width.

Give the "content" a { margin-right: 310px }. Its stuff will then
stay clear of the sidebar.


however...there is generally no point attempting to recreate an old
table layout using css...why not create a new layout that uses the
strengths of css rather than use it to imitate the strengths of
tables?


The OP simply wanted to put 2 lots of stuff side-by-side. That is sensible in
lots of cases. For example, it is a way of enabling the user to see the main
content & supplementary information in the viewport without (vertical)
scrolling between them.

I suspect that the original table was simply an attempt to achieve this layout
concept. Now, the OP wants to do it without tables. But the layout concept
remains valid.

Columns are very important. They enable the user, within seconds, to identify
where all the most important parts of the page are. And then to get to all of
them with just vertical scolling, for which there are various mechnical aids.
(I use a cordless batteryless mouse with a scroll-wheel).

The point is *not* to use the strengths of CSS! It is to achieve the objective
of communicating with the audience. And that may well be achieved with
side-by-side columns, that can jointly be accessed via vertical scrolling.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #9
Barry Pearson ne**@childsuppo rtanalysis.co.u k wrote:
Eric Jarvis wrote:
Barry Pearson ne**@childsuppo rtanalysis.co.u k wrote:
Toby Austin wrote:
> 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. [snip] 2 <div>s. Give them ids such as "content" and "sidebar".

Position the "sidebar", using { float: right } or { position:
absolute }. It has { width: 300px }.

Let the "content" just flow into position without positioning it.
Don't set a width.

Give the "content" a { margin-right: 310px }. Its stuff will then
stay clear of the sidebar.


however...there is generally no point attempting to recreate an old
table layout using css...why not create a new layout that uses the
strengths of css rather than use it to imitate the strengths of
tables?


The OP simply wanted to put 2 lots of stuff side-by-side. That is sensible in
lots of cases. For example, it is a way of enabling the user to see the main
content & supplementary information in the viewport without (vertical)
scrolling between them.


absolutely agreed...howeve r the fact that it was presented as a code
snippet of table layout implies the OP isn't as yet prepared to take the
plunge and start thinking in terms of "raw design concepts" taken straight
to css...something I believe they will find far easier and more effective
than interposing old table techniques as an intermediary stage

--
eric
www.ericjarvis.co.uk
"live fast, die only if strictly necessary"
Jul 20 '05 #10

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

Similar topics

1
3494
by: Xah Lee | last post by:
with strict HTML spec, can one have <p> tags inside table's <td> tag? also, in strict XHTML, can one have <p> tages inside <div>? Thanks. Xah xah@xahlee.org ∑ http://xahlee.org/
1
3905
by: Alan Hoyle | last post by:
I was using a <table border> to generate borders around some info/images, and decided to follow the w3c guidelines and convert it to CSS boxes with borders since it wasn't really tabular data. It used to be something like this: <table> <tr> <td><img>caption</td> <td><img>caption</td>
8
5144
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is pulling a name and placing it under the thumbnail (the text is
2
7572
by: listaction | last post by:
Hi Folks, can you help me by explaining how the code below can be translated using <div> and achieve the same effect? Thanks, LA <html> <body> <table bgcolor="#000000" width="100%" cellspacing="1">
4
1861
by: Alan Silver | last post by:
Hello, I would like to know if it is possible to use a panel, but prevent it from adding a <div> tag to the HTML. The reason I want to do this is that I am using a panel to enable me to show/hide part of a page as required. I would like the part in the panel to appear on the same line as the controls that precede it, but when the panel is converted to HTML, a <div> tag is used, and that forces a new line in the browser. Any ideas? TIA
13
2262
by: Mark | last post by:
Dear folks, In Javascript, is it possible to get all id names within, say, a <div></divpair? Like the array of "document.images", I mean. The reason I ask, is that I have a calender whose <td></tdtable elements, within a given <div></div>, all have a class type, one of which is "today" (to highlight it). Once the calender is drawn, the Javascript has ended. And since Javascript has no known (to me) method of storing variables in say,...
13
27503
by: Davo | last post by:
Hi Folks, There seems to be something about not using tables for layout, but use divs instead. I'm not sure if I've got this right. If the output looks like what you want, then it shouldn't matter what tags you use I would have thought, or am I missing something? tia, Davo
12
4204
by: slartybartfast | last post by:
I'm new(ish) to css, comfortable using tables, but trying real hard to move away. Please see http://84.9.125.31/developer/css_test/test5.html NB This issue is with IE & Opera - I've tried IE 6&7 and both have the same result. It works fine in FF. Thanks to Petr Stanicek for the original example. As you can see the table is 800px wide in the middle column and it's vertical position is affected by the amount of text in the left or right...
4
5281
by: harryusa | last post by:
I am trying to center 2 images concentrically which are z-indexed to lay on top of each other making an image with a border from another image that has a transparent center. I need the images to be horizonally and vertically centered within a <TD> </TD> area. No matter what I do the two image just present one above the other, albeit centered, NOT on top of each other. I originally did the entire page layout in TABLES until I found out I.E. 7...
0
8600
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7712
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4361
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.