Skip to content

Instantly share code, notes, and snippets.

@ganglio
Created March 30, 2012 10:22
Show Gist options
  • Save ganglio/2250629 to your computer and use it in GitHub Desktop.
Save ganglio/2250629 to your computer and use it in GitHub Desktop.
CSS - Alternative inline blocks
.container {
margin-top: 100px;
text-align: center;
font-size: 0;
}
.box {
background-color: green;
border-radius: 10px 10px 10px 10px;
font-size: 30px;
height: 40px;
line-height: 40px;
padding: 20px;
width: 100px;
margin: 10px 5px;
display: inline-block;
vertical-align: bottom;
-moz-transition: all 0.25s ease;
}
.box:hover {
height: 60px;
width: 150px;
margin: 0 5px;
line-height: 60px;
font-size: 40px;
}
.box:hover + .box {
background-color: red;
height: 50px;
width: 140px;
margin: 5px;
line-height: 50px;
font-size: 35px;
}
<!DOCTYPE HTML>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<title>Expandable Boxes</title>
<link rel="stylesheet" href="boxes.css" />
</head>
<body>
<div class="container">
<span class="box">pippo</span>
<span class="box">pippo</span>
<span class="box">pippo</span>
<span class="box">pippo</span>
<span class="box">pippo</span>
<span class="box">pippo</span>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment