Auto and specific widths

Discussion in 'CSS' started by lonewolff, Mar 13, 2011.

  1. #1
    Hi guys,

    I have a header that I want to split into two parts (left & right). I want the right side to be exactly 400px and the left side to auto adjust, depending on the client window size.

    So far I have a header container set to 100% width and left/right containers within that.
    I have specified right cont as 400px and the left comt to be auto.

    But, the left container is only adjusting to the width of the content (not the width of the remainder of the screen).

    Any ideas how I can achieve what I am after?

    Thanks in advance!
     
    lonewolff, Mar 13, 2011 IP
  2. lonewolff

    lonewolff Member

    Messages:
    338
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #2
    No takers?
     
    lonewolff, Mar 13, 2011 IP
  3. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #3
    Perhaps 2 choices:
    1. Use table (not necessarily a HTML table element)
    2. Use following style:
      #left{
      	width: auto;
      	background-color: blue;
      }
      #right{
      	float: right;
      	width: 400px;
      	background-color: red;
      }
      HTML:
      But the latter requires #right to be declared first:
      <div id="right">right</div>
      <div id="left">left</div>
      
      HTML:
     
    hdewantara, Mar 14, 2011 IP
  4. lonewolff

    lonewolff Member

    Messages:
    338
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #4
    That worked perfectly.

    Not far off what I was doing. But, CSS is a funny beast :confused:

    Thanks again! :cool:
     
    lonewolff, Mar 14, 2011 IP