When designing a CSS fluid layout, most divs utilize percentages to adjust based on the viewport size. However, I have a specific scenario where I need my sidebar to maintain a fixed position.
For instance:
<aside style="width:25%; float:left; position:fixed;">
aside content
</aside>
<div style="width:75%; float:left;">
main content
</div>
My ultimate goal is to ensure that the sidebar retains a particular width in relation to the viewport dimensions. For example, I would like it to remain 300px wide when the viewport ranges between 1000px and 1200px.
As an alternative approach, I also aim to keep the sidebar width at 300px if its parent div (although not specified in the previous example) exceeds 1000px.
This may require some JavaScript coding expertise, which unfortunately I lack. Any guidance or support from someone knowledgeable in JS would be greatly valued. Thank you!