Skip to content

Instantly share code, notes, and snippets.

@ghetolay
Last active May 11, 2016 08:45
Show Gist options
  • Save ghetolay/15a8c70a627d0f664316 to your computer and use it in GitHub Desktop.
Save ghetolay/15a8c70a627d0f664316 to your computer and use it in GitHub Desktop.
Border around multiple div as one
/* http://codepen.io/Ghetolay/pen/PNLKpO */
.container{
position: relative;
z-index: 0;
}
$borderSize: 2px;
/* 1px bigger only needed when sizes are float */
$coverBorderSize: $borderSize + 1px;
$bgColor: #f1f1f1;
.element{
position: relative;
background: $bgColor;
outline: $borderSize solid red;
padding: $coverBorderSize;
&:before{
content: '';
position: absolute;
z-index: 1;
top: 0;
left: 0;
bottom: 0;
right: 0;
border: $coverBorderSize solid $bgColor;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment