I’m currently working on a design challenge where I need to create a container that centers the content within 940px at large screen sizes, but provides a small margin at smaller screen sizes to prevent the content from hugging the sides of the page.
I attempted to use the calc() function to achieve this effect, but it seems to disrupt the margin and instead aligns everything to the left. I can't figure out why this is happening.
.container {
max-width: 940px;
margin: 0 auto;
@media screen and (max-width: 940px) {margin: 0 calc(auto + 20px); }
}