Jump to content

<div> width?


chiprivers

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.