I'm facing a challenge with two lists, one vertical and the other horizontal. I need to wrap one list inside the other, but the user can decide this at runtime. Setting the lists as display:block or display:inline-block doesn't seem to work in this case. Below is an example of the HTML structure:
<ul id="list1">
<li>
<ul id="list2"></ul>
</li>
</ul>
There are also two classes available for the lists - .horizontal and .vertical with specific CSS rules.
.horizontal li {
display: inline-block;
}
.vertical li {
display: block;
}
The issue arises when the user assigns these classes at runtime. The outermost class seems to override the innermost class, impacting the layout of the nested list. How can I ensure that the CSS properties of the inner list remain intact regardless of which class is assigned by the user?