I ran across this looking for a way to do a max-margin for responsive design. I need a 5% margin for mobile/tablet devices up to 48 pixels wide. Berd gave me the answer by using media queries.
My answer: 48 * 2 = 96 total max margin 96 is 10% of total width. 10 * 96 = (960) 100% of vw where 48px is the first time I want it to overwrite the % .
So my media queries to control my margins become:
@media (max-width: 959px) {
.content {
margin: 30px 5% 48px;
}
}
@media (min-width: 960px) {
.content {
display:block;
margin: 30px 48px 48px;
}
}