1
How do I make to reduce the padding
of UL
fixed
of 40px
for 20px
after scrolling the screen on 10px
only using CSS?
I tried as below but nay worked:
html, body {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: content-box; /*Comprimir(diminuir) as medidas do elemento para não aumentá-lo quando adicinar margin e padding*/
}
ul#menu {
position: fixed;
width: 100vw;
margin: 0 auto;
padding: 40px 0;
border: .1px solid #000;
}
ul#menu li {
display: inline-block;
width: 20%;
height: 100px;
line-height: 100px;
text-align: center;
}
@media screen and (min-height: 10px) {
ul#menu {
padding: 20px 0;
}
}
<ul id='menu'>
<li>Menu 1</li><!--
--><li>Menu 2</li><!--
--><li>Menu 3</li><!--
--><li>Menu 4</li><!--
--><li>Menu 5</li>
</ul>
Only with CSS not from pq CSS does not detect scroll event, but if you want a response with pure JS or jQuery, with 5 lines of code vc solves.
– hugocsl
Sure I do! So you mean @media screen and (min-height: doesn’t exist? Gives a version with Pure JS and another Jquery if it’s not too much to ask.
– Carlos Rocha
Of course
@media screen and (min-height:
Did you try to use it to solve your problem? I believe you didn’t even try because if you had tried you would have seen that it is not right... About JS or jQuery depends, do you already have jQuery in the project? If you already have it going jQuery, if you don’t have pure JS it’s better pq so you don’t need jQuery matter just for that– hugocsl
I don’t have jQuery]
– Carlos Rocha