Skip to content

Instantly share code, notes, and snippets.

@co0kie
Created March 2, 2015 12:31
Show Gist options
  • Save co0kie/b4af107335cbd536cc50 to your computer and use it in GitHub Desktop.
Save co0kie/b4af107335cbd536cc50 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="relative">
relative
<div class="absolute">
absolute
</div>
</div>
<div class="center-div">
div centered with 500px width
</div>
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
@import "compass";
// body{width: 700px;margin: 0 auto;padding: 20px;}
.relative{
position: relative;
width: 400px;
height: 100px;
border: 1px solid red;
.absolute{
background: #000;
color: #fff;
width: 200px;
position: absolute;
top: 0;
left: 0;
}
}
.center-div{
width: 500px;
margin: 0 auto;
border: 1px solid red;
padding: 20px;
}
.relative {
position: relative;
width: 400px;
height: 100px;
border: 1px solid red;
}
.relative .absolute {
background: #000;
color: #fff;
width: 200px;
position: absolute;
top: 0;
left: 0;
}
.center-div {
width: 500px;
margin: 0 auto;
border: 1px solid red;
padding: 20px;
}
<div class="relative">
relative
<div class="absolute">
absolute
</div>
</div>
<div class="center-div">
div centered with 500px width
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment