Jump to content

Recommended Posts

I have a basic page layout of two <div>'s nestled side by side inside another <div>:

==================================================================
= <div id="page">                                                                                            =
=  ===================  =========================================  =
=  = <div id="left">          =  =  <div id="right"                                                  =  =
=  =                              =  =                                                                      =  =
=  =                              =  =                                                                      =  =
=  =                              =  =                                                                      =  =
=  =                              =  =                                                                      =  =
=  =                              =  =                                                                      =  =
=  ===================  ==========================================  =
=                                                                                                                    =
==================================================================

#page should be the whole width of the display area, #left should have its width set by its content and #right should take up the remaining width.

I have used the following CSS:

#page {
width: 100%; padding: 10px
}

#left {
float: left
}

#right{
float: right: width: 100%
}


But using this CSS it puts #right down below #left and sets its width to 100% of #page instead of just the remaining space nestled next to #left.  How can I get the desired result?
Link to comment
https://forums.phpfreaks.com/topic/34003-width/
Share on other sites

Well either position it left rather that float it left

-----------------------
[code]
position:absolute;
margin-left:o;


[/code]
-----------------------

or  make it even like float left 30% and float right 70% or what eva why u want it . cause when rights = 100% it will push it below.


-----------------------Your script edited

[code]
#page {
width: 100%; padding: 10px
}

#left {
float: left;
width:30%;
}

#right{
float: right;
width: 70%
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34003-width/#findComment-160028
Share on other sites

I cant use percentages because the left div will contain a form which will always be a fixed width in pixels, the right hand div will contain a display of data which will always be a different size but I want the div to fill up the remaining space, irrespective of the window size.  (I intend to make this right div scrollable).
Link to comment
https://forums.phpfreaks.com/topic/34003-width/#findComment-160063
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.