Link to home
Start Free TrialLog in
Avatar of goodk
goodkFlag for United States of America

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;
    }
}
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of goodk

ASKER

thank you.

Could we do it without using jquery?
Could we do it without using jquery?

You mean with just CSS (no)
You mean with plain javascript (yes)