Attempting to create a 2 column layout has proven to be quite the challenge in CSS. Although tables are not recommended for layouts, I have resorted to using this CSS approach with the use of display: table.
div.container {
width: 600px; height: 300px; margin: auto;
display: table; table-layout: fixed;
}
ul {
white-space: nowrap; overflow: hidden;
display: table-cell;
width: 40%;
}
div.inner {
display: table-cell;
width: auto;
}
Implementing this structure:
<div class="container">
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>
<div class="inner">
<p>Hello world</p>
</div>
</div>
This method works well, but I can't help ponder whether I am strictly following the guideline against using tables. There doesn't seem to be any positioning markup directly in the HTML, so it should be acceptable. However, uncertainty lingers about the "correct" approach.
Using CSS float is not an option, as I need the columns to adjust based on available space.
Seeking guidance from the community, please assist me in overcoming my existential dread surrounding these pseudo-tables.