Skip to content

Instantly share code, notes, and snippets.

@wiseoldman
Last active December 17, 2018 13:20
Show Gist options
  • Save wiseoldman/87a1866a6487cb59ec4bf0037e39623a to your computer and use it in GitHub Desktop.
Save wiseoldman/87a1866a6487cb59ec4bf0037e39623a to your computer and use it in GitHub Desktop.
[Single div X button] Close button created with a single div and pseudo elements #close #button #scss
$xSize: 40px;
$xColor: #000;
.x-btn {
cursor: pointer;
width: $xSize;
height: $xSize;
position: relative;
&:before, &:after {
content: '';
background: $xColor;
position: absolute;
top: 50%;
height: 2px;
width: 100%;
}
&:before {
transform: rotate(45deg);
}
&:after {
transform: rotate(-45deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment