user5508297 user5508297 - 5 months ago 12
CSS Question

Responsive web design and fixed margins

What is the current best practice regarding responsive web design with fixed width margins?

When I try

margin-left: 80px;
in my jsfiddle, it pushes the screen width out so that it throws my percentage-based width styling off. How do I fix this?

In case it's relevant, I'm developing for a website that will only be viewed via Chrome on the desktop, by the way.


You can use calc(100% - 160px) in this case, I have updated your fiddle:

This of course if you have to use absolute positioning of the child, because then you would need to add an explicit width. If not, adding padding: 80px to the parent will do the trick.