I am facing a challenge in designing a webpage layout with a left sidebar and the remaining content aligned to the right of it. Most examples I have come across use <div>
tags with the display:table
and display:table-cell
properties where widths are specified in pixels for both the sidebar and the content area, or at least for the sidebar.
In my scenario, the contents within the sidebar are not predetermined. All I know is that they will not require much width (i.e., short lines and line-breaks ensure it does not expand extensively). Therefore, I do not wish to define a fixed width for the sidebar.
Is there a way to automatically adjust the sidebar <div>
to fit the widest elements it contains, while allowing the content <div>
to act as a column spanning from the right side of the sidebar to the edge of the page?