Please take a look at the code snippet: http://codepen.io/anon/pen/JItLa
I'm trying to show 2 rows of blocks with different amount of items in a row. The hover event should reveal the CSS shadow, but there is a problem: the right border of the shadow is overlapped with the next block. You would say the possible solution here is to use display:inline-block which leaves the gaps between the blocks, but I don't need the gaps. The blocks should stay sticky to each other but the right shadow should overlap the next block onhover.
html,
body {
margin: 0;
padding: 0
}
.wrapper {
width: 100%;
margin-top: 20px
}
.tile,
.tile2 {
float: left;
background: #f2f2f2
}
.tile {
width: 25%
}
.tile2 {
width: 33.3%;
border-left: 1px solid #ddd
}
.tile:hover,
.tile2:hover {
-webkit-box-shadow: 0 0 2px rgba(255, 255, 190, .75), 0 0 23px 1px #000;
-moz-box-shadow: 0 0 2px rgba(255, 255, 190, .75), 0 0 23px 1px #000;
box-shadow: 0 0 2px rgba(255, 255, 190, .75), 0 0 23px 1px #000
}
.header {
padding: 20px 0px 10px;
text-align: center
}
.clear {
clear: both
}
<div class="wrapper">
<div class="tile">
<div class="header">some text</div>
</div>
<div class="tile">
<div class="header">some text</div>
</div>
<div class="tile">
<div class="header">some text</div>
</div>
<div class="tile">
<div class="header">some text</div>
</div>
<div class="clear"></div>
</div>
<div class="wrapper">
<div class="tile2">
<div class="header">some text</div>
</div>
<div class="tile2">
<div class="header">some text</div>
</div>
<div class="tile2">
<div class="header">some text</div>
</div>
<div class="clear"></div>
</div>
See Question&Answers more detail:os