Skip to content

Instantly share code, notes, and snippets.

@i2r
Created February 19, 2020 07:25
Show Gist options
  • Save i2r/eed07927be00a81f001ca59296eb5896 to your computer and use it in GitHub Desktop.
Save i2r/eed07927be00a81f001ca59296eb5896 to your computer and use it in GitHub Desktop.
Sticky Top
/**
* Sticky Top
*/
html, body {
font-family: sans-serif;
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
}
html {
/*height: 100%;*/
}
body {
margin: 0;
padding: 100px 100px 50%;
}
.box {
background: green;
box-sizing: border-box;
border: dashed 3px rgba(255,255,255, 0.5);
}
.inner {
position: sticky;
right: 0;
top: 0;
color: white;
height: 1000px;
width: 30%;
box-sizing: border-box;
background: blue;
border: dashed 3px;
}
.content {
height: 3000px;
width: 65%;
color: #fff;
box-sizing: border-box;
background: red;
border: dashed 3px;
}
.content,
.inner {
display: inline-block;
padding: 10px;
vertical-align: top;
letter-spacing: 1px;
}
<div class="box">
<div class="content">CONTENT<b>COLUMN</b></div>
<div class="inner">STICKY<b>TOP</b></div>
</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment