I would like the list below to decrease the number of columns depending on the width of the parent div.
I have tried using a @media rule with max-width but it only takes into account the width of the browser, not of the parent div.
I have tried with width instead of max-width but it did not help.
#opponentsOfCivList {
columns: 4;
-webkit-columns: 4;
-moz-columns: 4;
padding-left: 25px;
list-style-type:disc;
}
@media screen and (max-width: 200px) {
#opponentsOfCivList {
columns: 2;
-webkit-columns: 2;
-moz-columns: 2;
padding-left: 5px;
list-style-type:disc;
}
}
li {
padding-left: 2px;
}
#opponentsOfCivList {
font-size: 12px;
}
<div style="background:grey; resize:horizontal; width:450px;overflow: auto;">
<ol id="opponentsOfCivList"><li value="Phoenicia">Phoenicia</li><li value="Austria-Hungary">Austria-Hungary</li><li value="Persia">Persia</li><li value="Siam">Siam</li><li value="Maya">Maya</li><li value="Korea">Korea</li><li value="Babylonia">Babylonia</li><li value="Brazil">Brazil</li><li value="Ethiopia">Ethiopia</li><li value="America">America</li><li value="Spain">Spain</li><li value="Aztec">Aztec</li><li value="Vikingland">Vikingland</li><li value="Egypt">Egypt</li><li value="Greece">Greece</li><li value="China">China</li><li value="Arabia">Arabia</li><li value="Turkey">Turkey</li><li value="Mongol">Mongol</li><li value="Inca">Inca</li><li value="Portugal">Portugal</li><li value="Rome">Rome</li><li value="Netherlands">Netherlands</li><li value="Byzantium">Byzantium</li><li value="France">France</li><li value="Germany">Germany</li><li value="India">India</li><li value="Japan">Japan</li><li value="Huns">Huns</li><li value="Russia">Russia</li><li value="England">England</li><li value="Iroquois">Iroquois</li></ol>
<p>resize this div at the bottom right!</p>
</div>