Despite the abundance of resources on CSS positioning, I constantly find myself revisiting this topic because it continues to perplex me with no clear solution in sight.
Let's simplify things. Imagine a header div with a width of 100%, like this:
<div style="width: 100%; height: 100px;">
</div>
Now, within this div on the left side of the screen are 4 links enclosed in a container div while on the right side, there are two links within another container div. These containers have set widths, leaving empty space in the middle.
<div style="width: 100%; height: 100px;">
<div style="width: 400px">
<div style="float: left; margin-left: 5px;">link1</div>
<div style="float: left; margin-left: 5px;">link2</div>
<div style="float: left; margin-left: 5px;">link3</div>
<div style="float: left; margin-left: 5px;">link4</div>
</div>
<div style="width: 200px">
<div style="float: left; margin-left: 5px;">link1</div>
<div style="float: left; margin-left: 5px;">link2</div>
</div>
</div>
The dilemma is how to make these fixed-sized containers align at each end of the fluid 100% container without overlapping or dropping below when the browser window is resized. The goal is to avoid scrollbars or JavaScript solutions altogether.
Is there a way for these fixed-size containers to remain snugly positioned as the page shrinks?
Floats and inline-block display properties haven't provided a resolution. Creating a large fixed-size container is not an option as the width must be maintained at 100%. Currently relying on Javascript to hide the right links upon shrinking the page size, which is less than ideal.
Is there truly no workaround for this predicament?