2 divs inline, overflow:hidden on the left one

Discussion in 'CSS' started by FaithRaven, Jan 27, 2008.

  1. #1
    Hello

    I have 2 divs which contain text of a variable length that I want to be displayed inline, in only 1 text line. The first div have float:left; the second have float:right;.

    The issue I have is when the left div have a very long text inside that won't fit. I've put a fixed height and overflow:hidden on it, but it is not working unless I also put a fixed width, which I really try to avoid.

    Thanks in advance
     
    FaithRaven, Jan 27, 2008 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    can you fix the width of the float:right one? Then on the other one you could not float it, and give it a margin on that side to make sure it clears (or not if you want it to wrap underneath)
     
    deathshadow, Jan 27, 2008 IP
  3. FaithRaven

    FaithRaven Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    No I can't do that. The right div also have a variable width depending of the text that get put in it.

    Is giving a fixed width to one of the divs the only solution to my problem ?
     
    FaithRaven, Jan 27, 2008 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Well, there is another fix - but you aren't going to like it. There are these things called tables...
     
    deathshadow, Jan 27, 2008 IP