Created
July 31, 2013 04:10
-
-
Save tiendq/6119201 to your computer and use it in GitHub Desktop.
How to fight inline blocks space and heigh 100%
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<style> | |
.parent { | |
width: 600px; | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
background-color: yellow; | |
} | |
.child { | |
display: inline-block; | |
width: 200px; | |
background-color: green; | |
} | |
.child-margin { | |
display: inline-block; | |
width: 200px; | |
background-color: green; | |
margin-left: -0.25em; | |
} | |
.child-margin:first-of-type { | |
margin-left: 0; | |
} | |
html, body, .container { | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
.container { | |
background-color: #ccc; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<!-- fixing inline block space http://tympanus.net/codrops/2013/07/17/troubleshooting-css/ --> | |
<div class="parent"> | |
<div class="child">I'm a child!</div><!-- | |
--><div class="child">I'm a child!</div><!-- | |
--><div class="child">I'm a child!</div> | |
</div> | |
<br /> | |
<div class="parent"> | |
<div class="child-margin">I'm a child!</div> | |
<div class="child-margin">I'm a child!</div> | |
<div class="child-margin">I'm a child!</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment