|
Posted by David E. Ross on May 31, 2007, 8:18 pm
Please log in for more thread options
JD wrote:
> kw wrote:
>> A new html learner is here. Please help.
>> I write a two column web page. Their widths are both fixed.
>> The left one is a menu and the right one is mainly for content
>> display. I pasted a few lines as the following:
>>
>> #leftcolumn{
>> background-color: white;
>> clear: left;
>> width: 176px;
>> margin-left: 3px;
>> margin-right: 3px;
>> float: left;
>> margin-top: 3px;
>> }
>>
>> #rightcolumn{
>> background-color: transparent;
>> width: 560px;
>> float: left;
>> overflow: auto;
>> border-left: 1px solid #C3C3C3;
>> padding-left: 10px;
>> padding-right: 10px;
>> margin-top: 6px;
>> padding-bottom: 1em;
>> }
>>
>> The web page is correct when the browser's window is wide enough;
>> it behaves incorrectly when the window is narrow. That is say the
>> right column automatically flushes to underneath the left column.
>>
>> What property can be specified to lock the right column?
>
> Enclose both divs in a fixed-width wrapper. Also, float the #rightcolumn
> div right, not left. This will create a natural gutter between the two
> columns provided the widths of the two nested divs fall short of the
> width of the wrapper.
If you use "a fixed-width wrapper", you are likely to force right-left
scrolling for any user whose window is not wide enough. This is so
annoying that you will lose some of your audience.
Instead, follow the advice in earlier replies to use percentage widths.
That way, your page will adapt to whatever window width the user has.
--
David E. Ross
<http://www.rossde.com/>.
Don't ask "Why is there road rage?" Instead, ask
"Why NOT Road Rage?" or "Why Is There No Such
Thing as Fast Enough?"
<http://www.rossde.com/roadrage.html>
|