Skip to content

Instantly share code, notes, and snippets.

@ferdiemmen
Created November 20, 2017 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferdiemmen/1e466cbf1205dec8b0c3de54f4a432f1 to your computer and use it in GitHub Desktop.
Save ferdiemmen/1e466cbf1205dec8b0c3de54f4a432f1 to your computer and use it in GitHub Desktop.
Fix margin on child element not visible on parent
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<style>
#parent {
width: 100%;
background: red;
overflow: hidden;
}
#child {
background: green;
margin: 20px 0;
}
</style>
</head>
<body>
<div id="parent">
<div id="child">foobar</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment