Skip to content

Instantly share code, notes, and snippets.

@zeshanshani
Created October 26, 2016 12:58
Show Gist options
  • Save zeshanshani/dc6b408bfb7d013d6f3c09662ec936b7 to your computer and use it in GitHub Desktop.
Save zeshanshani/dc6b408bfb7d013d6f3c09662ec936b7 to your computer and use it in GitHub Desktop.
Pure CSS cross in both SCSS and CSS.
.element {
position: relative;
height: 22px;
height: 2.2rem;
width: 22px;
width: 2.2rem;
}
.element:before, .element:after {
content: '';
height: 1px;
height: 0.1rem;
width: 22px;
width: 2.2rem;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
background-color: #fff;
position: absolute;
display: block;
margin-top: 11px;
margin-top: 1.1rem;
}
.element:after {
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
// Mixins and Variables are being used from this gist:
// https://gist.github.com/zeshanshani/c4d5ae43e6a9f661d012
// Bourbon.io is also a dependency.
// For it's CSS generated output, look at the second file below.
$size: 22px;
position: relative;
@include size-rem( $size );
&:before,
&:after {
content: '';
@include size-rem( $size 1px );
@include transform( rotate( 45deg ) );
background-color: #fff;
position: absolute;
display: block;
@include margin( $size / 2, 'top' ); // to align center the lines vertically
}
&:after {
@include transform( rotate( -45deg ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment