I am looking to align the content of a div element in a single row while dealing with an unknown width of the ul element due to varying child li elements. The h2 will always take up the remaining space, and each li element has a width of 20px.
The desired layout would resemble this:
|----h2------------|li|li|li||
|----h2---------------|li|li||
Here is the HTML code structure:
<div>
<h2>name</h2>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
I have come across several solutions online but I am unsure which one to choose (best practice vs workaround). Browser compatibility is not an issue as it only needs to function on the latest version of Chrome.
Update: There will be multiple rows of div elements and it is important for the li elements to align properly.