You are here: Re: make a div use maximum width « HTML « IT news, forums, messages
Re: make a div use maximum width

Posted by Martin Jay on 08/22/07 05:38

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация