goodk
asked on
How to do media command mathematically?
I want to reduce the margin from 35 to 15 as the screen size reduces from max to 600px
I would like margin number to be mathematically calculated as it would be cumbersome to keep adding media commands. Is it possible to achieve it, how?
#DevMenu li
{
padding: 0px 35px 0px 10px;
}
@media screen and (max-width:800px)
{
#DevMenu li
{
padding: 0px 20px 0px 10px;
}
}
@media screen and (max-width:600px)
{
#DevMenu li
{
padding: 0px 10px 0px 10px;
}
}
I would like margin number to be mathematically calculated as it would be cumbersome to keep adding media commands. Is it possible to achieve it, how?
#DevMenu li
{
padding: 0px 35px 0px 10px;
}
@media screen and (max-width:800px)
{
#DevMenu li
{
padding: 0px 20px 0px 10px;
}
}
@media screen and (max-width:600px)
{
#DevMenu li
{
padding: 0px 10px 0px 10px;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Could we do it without using jquery?
You mean with just CSS (no)
You mean with plain javascript (yes)
ASKER
Could we do it without using jquery?