potato potato - 1 year ago 69
CSS Question

How to make section 100% size with margins?

I want a border with pictures and parallax scrolling, so i added a section in the body and had the content in that. but when i make the section 100% or 100vh and add margin it goes outside the body.

Answer Source

You need the section as full height with 20px margin. So i have added the fiddle here

And the code here

<body style="margin:0;background: red; width:100%;height:100%;">

    <section style="position: absolute; display: inline-block; top:0; left:0; bottom:0; width:200px;  margin:20px; background:green;">

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download