Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   make a div use maximum width (http://www.velocityreviews.com/forums/t531376-make-a-div-use-maximum-width.html)

Gernot Frisch 08-21-2007 08:49 AM

make a div use maximum width
 

Hi,
I want the green piece ("Please be wide") to fill the whole space
between the red and the blue thingy. How can I do that?

Thank you in advice,
-Gernot

PS: My code is as minimal as possible, I know I should use strict-html
and stuff.


<html>
<body>
<div style="width:50%;">
<!-- left item -->
<div style="float:left; width:16px; background-color:Red;"></div>

<!-- center text -->
<div style="float:left; background-color:green;">Please be wide</div>
<!-- right item -->
<div style="float:right; width:16px; background-color:blue;"></div>
</div>
</body>
</html>





Neredbojias 08-21-2007 11:51 AM

Re: make a div use maximum width
 
Well bust mah britches and call me cheeky, on Tue, 21 Aug 2007 08:49:07 GMT
Gernot Frisch scribed:

>
> Hi,
> I want the green piece ("Please be wide") to fill the whole space
> between the red and the blue thingy. How can I do that?
>
> Thank you in advice,
> -Gernot
>
> PS: My code is as minimal as possible, I know I should use strict-html
> and stuff.
>
>
> <html>
> <body>
> <div style="width:50%;">
> <!-- left item -->
> <div style="float:left; width:16px; background-color:Red;"></div>
>
> <!-- center text -->
> <div style="float:left; background-color:green;">Please be wide</div>
> <!-- right item -->
> <div style="float:right; width:16px; background-color:blue;"></div>
> </div>
> </body>
> </html>


Put a &nbsp; after <div style="width:50%;">

--
Neredbojias
Half lies are worth twice as much as whole lies.

Gernot Frisch 08-21-2007 12:18 PM

Re: make a div use maximum width
 

>
> Put a &nbsp; after <div style="width:50%;">


No. Neither in IE6, nor in FF.



Martin Jay 08-22-2007 05:38 AM

Re: make a div use maximum width
 
On Tue, 21 Aug 2007 10:49:07 +0200, "Gernot Frisch" <Me@Privacy.net>
wrote:
>I want the green piece ("Please be wide") to fill the whole space
>between the red and the blue thingy. How can I do that?


This is because the centre DIV isn't given a width.

><html>
><body>
><div style="width:50%;">
> <!-- left item -->
> <div style="float:left; width:16px; background-color:Red;"></div>
>
> <!-- center text -->
> <div style="float:left; background-color:green;">Please be wide</div>
> <!-- right item -->
> <div style="float:right; width:16px; background-color:blue;"></div>
></div>
></body>
></html>


One solution may be to wrap the left, centre and right DIVs into an
additional DIV, and give that a green background colour:

<html>
<body>
<div style="width:50%;">

<div style="background-color: green; float: left;">

<!-- left item -->
<div style="float:left; width:16px; background-color:Red;"></div>
<!-- center text -->
<div style="float:left; background-color:green;">Please be wide</div>
<!-- right item -->
<div style="float:right; width:16px; background-color:blue;"></div>
</div>

</div>

</body>
</html>
--
Martin Jay

Gernot Frisch 08-22-2007 07:56 AM

Re: make a div use maximum width
 

> One solution may be to wrap the left, centre and right DIVs into an
> additional DIV, and give that a green background colour:


Perfect! That's the way to do it.




All times are GMT. The time now is 06:25 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.