ThomasJSmart
Programmer
- Sep 16, 2002
- 634
Trying to achieve the following:
1. A parent container positioned absolute, because of reasons.
2. child elements that should be next to each other horizontally and push the parent width out. The number of child elements is dynamic but will not change after initial page load.
3. the above "pushing" is needed to prevent empty parent space in cases with less child elements, and should happen up to max-width value, then the child elements should wrap and continue on the next line.
to achieve 2 I can simply do display: inline-block on the child and white-space:nowrap on the parent, but this fails when there are too many children.
iv been trying different combinations of width, display, float en white-space but so far have only managed to either have all the children listed vertically, or horizontally further than max-width or have had a parent with lots of unused white space next to the few child elements.
site | / blog |
1. A parent container positioned absolute, because of reasons.
2. child elements that should be next to each other horizontally and push the parent width out. The number of child elements is dynamic but will not change after initial page load.
3. the above "pushing" is needed to prevent empty parent space in cases with less child elements, and should happen up to max-width value, then the child elements should wrap and continue on the next line.
to achieve 2 I can simply do display: inline-block on the child and white-space:nowrap on the parent, but this fails when there are too many children.
iv been trying different combinations of width, display, float en white-space but so far have only managed to either have all the children listed vertically, or horizontally further than max-width or have had a parent with lots of unused white space next to the few child elements.
site | / blog |