9

I've got the following peace of code - http://jsfiddle.net/QkYvs/2/

    <div id="parent">
        <div id="childOne">
            <div id="childTwo"></div>
        </div>
    </div>

#childTwo is wrapping its text to the #parent width. How can I make #childTwo's width to be its content's width?

gespinha
  • 7,968
  • 16
  • 57
  • 91
  • See [absolute vs relative position width & height](http://stackoverflow.com/questions/5323177/absolute-vs-relative-position-width-height) – megawac Oct 20 '13 at 22:52
  • It is not possible to make an absolutely positioned element assume the size of its contents. Do you want to use a wrapper element to simulate it? You may also be interested in CSS3 flexbox, if you don't care about older browsers. – Azmisov Oct 20 '13 at 22:53

1 Answers1

25
white-space:nowrap;

See this fiddle.

Justin Lessard
  • 10,804
  • 5
  • 49
  • 61