Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > DIV not correctly sized in TD

Reply
Thread Tools

DIV not correctly sized in TD

 
 
boeledi
Guest
Posts: n/a
 
      10-11-2007
Hello,

I have the following problem with DIVs, embedded in table TDs.
In two words, I would like to have one DIV per TD, each of these DIV
taken the full size.
Here is an example:

<html>
<head>
<style>
.clsFull {width:100%;height:100%;background-color:#ff0;border:1px
solid #000;}
</style>
</head>
<body>
<table cellpadding=2 cellspacing=2 border=1 width=90%>
<tr>
<td colspan=4>
<div class="clsFull" style="height:60px;"><p>Header</p></div>
</td>
</tr>
<tr>
<td colspan=2 width=50%>
<div class="clsFull"><p>Left</p></div>
</td>
<td colspan=2 rowspan=2 width=50%>
<div class="clsFull"><p>Right</p></div>
</td>
</tr>
<tr>
<td colspan=2 width=50%>
<div class="clsFull" style="height:100px;"><p>Left 2</p></div>
</td>
</tr>
<tr>
<td colspan=3>
<div class="clsFull" style="height:200px;"><p>Down Left</p></div>
</td>
<td width=25%>
<div class="clsFull"><p>Down Right</p></div>
</td>
</tr>
</table>
</body>
</html>

The result is that everything is correct EXCEPT "Right" et "Down
Right" parts. The corresponding DIVs are not sized correctly in the
sense that it is not 100% width and height.

Could anyone help me?
Many thanks

 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      10-11-2007
On 11 Oct, 13:24, boeledi <didier.boel...@steams.be> wrote:

> I have the following problem with DIVs, embedded in table TDs.


So stop doing that. You can style the <td>s too, just as easily as the
<div>s. You don't appear to be doing anything that requires these
extra elements.


Also you're not using a doctype declaration, so your browser will
render in quirks mode. Before worrying about any layout problems,
especially those involving box widths, you must push the browser into
standards mode. I suggest adding the HTML 4.01 Strict doctype
declaration.

 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      10-11-2007
Well bust mah britches and call me cheeky, on Thu, 11 Oct 2007 12:24:30
GMT boeledi scribed:

> Hello,
>
> I have the following problem with DIVs, embedded in table TDs.
> In two words, I would like to have one DIV per TD, each of these DIV
> taken the full size.
> Here is an example:
>
> <html>
> <head>
> <style>
> .clsFull
> {width:100%;height:100%;background-color:#ff0;border:1px
> solid #000;}
> </style>
> </head>
> <body>
> <table cellpadding=2 cellspacing=2 border=1 width=90%>
> <tr>
> <td colspan=4>
> <div class="clsFull"
> style="height:60px;"><p>Header</p></div>
> </td>
> </tr>
> <tr>
> <td colspan=2 width=50%>
> <div class="clsFull"><p>Left</p></div>
> </td>
> <td colspan=2 rowspan=2 width=50%>
> <div class="clsFull"><p>Right</p></div>
> </td>
> </tr>
> <tr>
> <td colspan=2 width=50%>
> <div class="clsFull"
> style="height:100px;"><p>Left 2</p></div>
> </td>
> </tr>
> <tr>
> <td colspan=3>
> <div class="clsFull"
> style="height:200px;"><p>Down Left</p></div>
> </td>
> <td width=25%>
> <div class="clsFull"><p>Down
> Right</p></div>
> </td>
> </tr>
> </table>
> </body>
> </html>
>
> The result is that everything is correct EXCEPT "Right" et "Down
> Right" parts. The corresponding DIVs are not sized correctly in the
> sense that it is not 100% width and height.


Why do you have a height designation on a div in all but the 2nd row?

Anyway, try adding a height to either the pertinent div or the cell
within which it rests (so your percentage designation has a reference).
This may still not work in the latter case as tables are unruly beasts,
and you should probably nevertheless delimit your non-css values.

--
Neredbojias
Half lies are worth twice as much as whole lies.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
problem with dynamic width div not filling with a color correctly John Dalberg HTML 3 10-18-2006 08:33 PM
Oddly sized sized password textbox thechaosengine ASP .Net 1 09-15-2005 07:34 PM
NS/FF don't change div offsetWidth when div innerHTML is added toand div becomes wider mscir Javascript 3 06-26-2005 04:04 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57