I have following problem:
I have div containing other elements and I try to make its width dependent from the content. I also restrict maximum width of this div. I use <
By default, a block-level element will expand to fill as much width as possible. So its width is basically "100%" (sort of) and you're saying a maximum of 1000px, so it's expanding to the maximum of 1000px. The minimum width is still being achieved (it's at least 500px). Try setting display: inline-block
on the element and see if that helps you out any. This should make it only expand as far as its content while still paying attention to the minimum and maximum widths. You may have to add a breaker <br />
after to make the rest of your content adapts to it being inline.