I'm working on a website and I need to create a script that can detect when the page width is greater than 500px or less than 500px so I can adjust the layout accordingly. At the bottom of the page, there are some links arranged like a footer. When the page width is below 500px, I want these links to be closer together, for example:
<div class="footer-titles">
<ul class="footer-titles-ul">
<li><h class="titles">Link 1</h></li>
<li><h class="titles">Link 2</h></li>
<li><h class="titles">Link 3</h></li>
</ul>
</div>
Here is my CSS code:
.footer-titles{width: auto; min-width: 800px; left: 0px; right: 0px; position: absolute; bottom: 210px;}
.footer-titles-ul {list-style: none; padding-left: 120px;}
.footer-titles-ul li {padding-right: 90px; display: inline;}
When the page width is below 500px, I want to change the padding-right of the .footer-titles-ul li to 30px. However, if the page width goes back to being over 500px, I want it to go back to its original value.