Skip to content

Instantly share code, notes, and snippets.

@EtienneLem
Created February 28, 2013 00:26
Show Gist options
  • Save EtienneLem/5053176 to your computer and use it in GitHub Desktop.
Save EtienneLem/5053176 to your computer and use it in GitHub Desktop.
Display inline-block example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
* {
margin: 0; padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
outline: 1px solid hotpink;
}
div {
font-size: 0;
padding: 20px
}
p, span {
display: inline-block;
vertical-align: middle;
}
span {
background-color: #ddd;
width: 100px; height: 100px;
margin-right: -100px;
}
p {
font-size: 14px;
margin-left: 120px;
padding: 10px;
}
</style>
</head>
<body>
<div>
<span></span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</body>
</html>
@EtienneLem
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment