Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > DIV wider than TD (cell)

Reply
Thread Tools

DIV wider than TD (cell)

 
 
gorbus
Guest
Posts: n/a
 
      07-29-2005
I put DIV into table cell. DIV is POSITION:RELATIVE. TOP and LEFT
properties of DIV works fine but not WIDTH. When DIV is wider than TD,
TD is also wider... WHY ?


Gorb

PLEASE help

 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      07-29-2005
gorbus wrote:

> I put DIV into table cell. DIV is POSITION:RELATIVE. TOP and LEFT
> properties of DIV works fine but not WIDTH. When DIV is wider than TD,
> TD is also wider... WHY ?


Because that's what TD's do. What would be the result you're after?

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -
 
Reply With Quote
 
 
 
 
gorbus
Guest
Posts: n/a
 
      07-29-2005
In short: I'd like to show div which is bigger than td. I inserted it
into TD, because I want to position DIV relatively to TD. Is it
possible ?
And of course: TD cannot change its size....

 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      07-29-2005
gorbus wrote:

> In short: I'd like to show div which is bigger than td. I inserted it
> into TD, because I want to position DIV relatively to TD. Is it
> possible ?
> And of course: TD cannot change its size....


This makes no sense to me, but maybe what you are looking for, is
position:absolute, not relative. To make it relative to the TD, you
could give that TD position:relative, and the DIV position:absolute.

It does sound like a very ugly hack though, for something that most
likely could be done in a proper way. However, without seeing your
page or understanding your objective, I can't offer a different
method.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -
 
Reply With Quote
 
gorbus
Guest
Posts: n/a
 
      07-29-2005
I did as u said but it didn't help - TD is still 200px and should be
100px (when rendered of course):

<TD style="WIDTH: 100px; POSITION: relative" vAlign="top" width="100"
height="100">

<DIV style="LEFT: 50px; WIDTH: 200px; POSITION: relative;
BACKGROUND-COLOR: red">sample text</DIV>

</TD>

 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      07-29-2005
gorbus wrote:

> I did as u said but it didn't help - TD is still 200px and should be
> 100px (when rendered of course):
>
> <TD style="WIDTH: 100px; POSITION: relative" vAlign="top" width="100"
> height="100">
>
> <DIV style="LEFT: 50px; WIDTH: 200px; POSITION: relative;
> BACKGROUND-COLOR: red">sample text</DIV>
>
> </TD>


If only you would quote the relevant bits of the message you are
replying to, you would notice a very distinct discrepancy between what
I wrote and what you did.

Hint: relative != absolute



--
Els http://locusmeus.com/
Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -
Now playing: Bodysnatchers - Ruder Than You
 
Reply With Quote
 
gorbus
Guest
Posts: n/a
 
      07-29-2005
And this 'hint' is enought! Thanks, u help me v. much.

Gorb

 
Reply With Quote
 
Animesh Kumar
Guest
Posts: n/a
 
      07-29-2005
gorbus wrote:

> I did as u said but it didn't help - TD is still 200px and should be
> 100px (when rendered of course):
>
> <TD style="WIDTH: 100px; POSITION: relative" vAlign="top" width="100"
> height="100">


You may also want to put a semi-colon after "relative" and "color: red"
in the style field. (Just to be safe).

>
> <DIV style="LEFT: 50px; WIDTH: 200px; POSITION: relative;
> BACKGROUND-COLOR: red">sample text</DIV>
>
> </TD>
>

 
Reply With Quote
 
Noodles Jefferson
Guest
Posts: n/a
 
      07-30-2005
In article <(E-Mail Removed) .com>,
gorbus ((E-Mail Removed)) dropped a +5 bundle of words...

> In short: I'd like to show div which is bigger than td. I inserted it
> into TD, because I want to position DIV relatively to TD. Is it
> possible ?
> And of course: TD cannot change its size....


Your div's going to be forced to fit the td. Now, you can position the
div within the td through say <div style="vertical-align:top"> or <div
style="padding-left:.3em"> (for example) but it's still not going to be
bigger than your td. Once you use table, the boxes are pretty much
locked down to a set position. Now, you can use the rowspan and colspan
to get a big td instead of say two little td's, just don't forget that
each cell you do like that means less cells in whichever rows apply.

<table border="1">
<tr>
<td colspan="2">This takes up two td's horizontally</td>
<td>This would be the one on the end</td>
</tr>
<td rowspan="2">This one takes up two td's vertically</td>
<td>This one will be in the middle of the second row</td>
<td>This one's on the end of the second tow.</td>
</tr>
<tr>
<td>This one will be in the middle of the third row</td>
<td>This one will be on the end of the third row</td>
</tr>
</table>


--
Noodles Jefferson
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

"Our earth is degenerate in these latter days, bribery and corruption
are common, children no longer obey their parents and the end of the
world is evidently approaching."
--Assyrian clay tablet 2800 B.C.
 
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
TD tags are wider than necessary Nathan Sokalski ASP .Net 4 04-25-2007 03:26 AM
Textboxes are rendered wider than other input controls funstercinsolata@gmail.com ASP .Net 3 06-27-2006 03:53 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
textbox property - columns: why does it make width much wider than it needs? TS ASP .Net 2 04-22-2004 02:33 PM



Advertisments