473,466 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I make div heights relative like a table row & cell

Hey People,

I'm facing a issue with browser compatablity here, I want a certain
group of divs to behave like a table row, i.e if one of the cell/div
has content longer than the other divs, all the other divs should
reflect the same height. I managed to get success in doing this with
mozilla (i love it!) and Opera 7, but IE seems to be ignoring the
defined function (again!) of the properties display: table, table-row,
table-cell...

Can you help? The only restriction I have is I want to avoid the use o
f Javascript for this.

Here is the page code for your reference...

---------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title></title>
<style>
body {
margin: 0px;
}

div.outTable {
width: 100%;
display: table;
}
div.rowTable {
display: table-row;
}
div.cellTable {
display: table-cell;
width: 25%;
background-color: Aqua;
}
div.cellTableTwo {
display: table-cell;
width: 25%;
background-color:Blue;
}

/*IE Only code */
* html div.outTable {
width: 100%;
display: block;
height: 100%;
border: 1px #f00 dotted;
}
* html div.rowTable {
display: inline;
height: 100%;
}
* html div.cellTable {
display: inline;
width: 25%;
background-color: Yellow;
float: left;
height: auto;
}
* html div.cellTableTwo {
display: inline;
width: 25%;
background-color:Orange;
float: left;
height: auto;
}
</style>
</head>

<body>

<div class="outTable">
<div class="rowTable">
<div class="cellTable">Hello Testing</div>
<div class="cellTableTwo">Hello World!</div>
<div class="cellTable">Hello World! This is the text to test if all
the divs reflect the same height as this div, IE fails the text but
mozilla pass it. How do get all versions of IE 5.x, IE 6.0.x to work
with this.</div>
<div class="cellTableTwo">Hello Testing </div>
</div>
</div>

</body>
</html>
------------------------------------------------
Cheers!

Shashwat Nagpal
http://www.shashwat.com

Jul 21 '05 #1
4 10229
"Shash" <sn*****@gmail.com> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
Hey People,

I'm facing a issue with browser compatablity here, I want a certain
group of divs to behave like a table row, i.e if one of the cell/div
has content longer than the other divs, all the other divs should
reflect the same height. I managed to get success in doing this with
mozilla (i love it!) and Opera 7, but IE seems to be ignoring the
defined function (again!) of the properties display: table, table-row,
table-cell...


If you're looking for something that behaves like a table, why not use
a table? There is certainly nothing wrong with using tables the way
they were designed to be used. Seems like the most reliable approach.

--
Arctic Fidelity <sp**@sacrificumdeo.net>
<http://www.sacrificumdeo.net>
"Beware of bugs in the above code; I have only proved it correct, not
tried it." -- Donald Knuth

Jul 21 '05 #2
I can not use a table here b'coz the data that's gonna be in these
blocks is not a tabular data and W3C & WAI guidelines clearly state
that use tables only for tabular data not for layouts...

And in this case if I use tables it will change the meaning of the
content assuming some one uses a screen reader to get the contents of
the page...

Jul 21 '05 #3
Shash schrieb:
I can not use a table here b'coz the data that's gonna be in these
blocks is not a tabular data and W3C & WAI guidelines clearly state
that use tables only for tabular data not for layouts...


What is the difference between <div class="outTable"> using
display: table and <table> apart from the names? Your divs will
have the same nesting structure as table, tr and td, won't they?

I think W3C didn't ban your <div class="outTable"> because they
cannot guess all the class names web developers come up with to
circumvent the <table> ban :)

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 21 '05 #4
Peter Maas wrote:
What is the difference between <div class="outTable"> using
display: table and <table> apart from the names?
The first is for elements that _look like_ a table (grid), The second is
for elements that _are_ and _should be perceived_ as a table. E.g. some
assistive technologies have a table mode with associating headers to
data cells etc. This is not necessary for something that only looks like
a grid.
Your divs will
have the same nesting structure as table, tr and td, won't they?


Not necessarily. Some boxes may be generated automatically by the renderer.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 21 '05 #5

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

Similar topics

4
by: Ken Kast | last post by:
Here's my situation. I have a statically positioned table that has an image in a cell. I also have some layers, defined by absolute-positioned DIVs for some animation. Everything works until I...
8
by: Andrew Ayre | last post by:
Hi, I have the following table layout: --------------------- | A | E | ------ |
9
by: Lot-o-fun | last post by:
Suppose I make a table that looks like --------- | A | | |---| | | B | D | |---| | | C | | ---------
2
by: Catherine Lynn Wood | last post by:
I need to know how to overlap DIV content within 'relative' associated rendering. I am building div layers in the middle of a page and when I set positioning to absolute in the CSS, it references...
7
by: lauren quantrell | last post by:
A while back I got a requirement for the client to be able to adjust the relative heights of two subforms by click-dragging the mouse and I came up with a kludge solution using a border control...
8
by: Edward | last post by:
I used to do this all the time in HTML-table layouting. How do I do this in CSS? -------------------------------------------------- <table width="400px"> <tr> <td bgcolor="beige">one line of...
19
by: derelicten | last post by:
hello , I have an issue positionating some pics I want to anchor to an existing table cell but I cant just place regular position on the cell because the background is fixed height and the set of...
5
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
1
by: thomasv | last post by:
Hi, I want to convert the following XML (OpenOffice Calc file): <?xml version="1.0" encoding="UTF-8"?> <office:document-content ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
1
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...
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...
0
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...
0
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...

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.