Problems mixing auto and fixed widths

Discussion in 'CSS' started by lonewolff, Jun 15, 2011.

  1. #1
    Hi Guys,

    I am currently having an issue where I am trying to make a column 'auto' width.

    What I am trying to acheive is this (without the red borders, example only);

    [​IMG]

    With the CSS code below;

    .searchImage	{width:182px;
    		height:auto;
    		float:left;}
    
    .searchDesc	{width:350px;
    		height:auto;
    		float:left;}
    
    .searchExtra	{width:182px;
    		height:auto;
    		float:right;}
    
    Code (markup):
    If I leave the code as width:350px everything looks ok until the browser window is resized (smaller) and then .searchExtra jumps to the next space below (as expected).

    So, I want the text to gracefully resize and keep everything more or less as displayed above.

    If I set the .searchDesc width to auto, then .searchExtra gets pushed below automatically and the text takes up the whole right side of the frame.

    Any Ideas how I can modify my code to display items as the pic above and have the text area resize only?

    Thanks in advance :cool:
     
    lonewolff, Jun 15, 2011 IP
  2. lonewolff

    lonewolff Member

    Messages:
    338
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #2
    Is this too hard?
     
    lonewolff, Jun 16, 2011 IP
  3. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You have two choices. Make a large container div for all elements and set constraints on the elements, or use position: and right: to anchor the right most element where it is.
     
    ntomsheck, Jun 17, 2011 IP
  4. lonewolff

    lonewolff Member

    Messages:
    338
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #4
    Hi ntomsheck,

    I tried postition:absolute and right:0px , which gives a slightly closer result to what I want. But, the text in the center block still wont resize. Now the right side block will move over the top of the text.

    Any ideas would be awesome. :)
     
    lonewolff, Jun 20, 2011 IP