.wrapper
.header
.inner
ul.btns
li.btn.a Button
li.btn.b Button
li.btn.c Button
.body
h1.ttl MIN-WIDTH: 980px
View Compiled
* {
user-select: none;
}
.wrapper {
min-width: 980px;
min-height: 200vh;
background: #1d1f20;
}
.header {
$height: 70px;
position: relative;
width: 100%; height: $height;
.inner {
box-sizing: border-box;
position: fixed;
border-bottom: 5px solid #343436;
min-width: 980px;
width: 100%; height: $height;
background: linear-gradient(#080808, #000000);
box-shadow: 0 1px 1px black;
z-index: 10;
}
}
.btns {
float: right;
padding: 3.5px;
overflow: hidden;
.btn {
box-sizing: border-box;
float: left;
margin: 3.5px;
padding: 0 15px;
border: solid 3px #343436;
border-radius: 2px;
height: 50px;
color: #fff;
font: 15px "Lato", "Lucida Grande","Lucida Sans Unicode", Tahoma, Sans-Serif;
line-height: 43px;
cursor: pointer;
&:before {
margin: 0 10px 0 0;
color: transparent;
font: 15px AvenirNext-Heavy;
-webkit-text-stroke: 1px #fff;
}
&.a {
&:before {
content: "A";
}
}
&.b {
&:before {
content: "B";
}
}
&.c {
&:before {
content: "C";
}
}
&:hover {
background: #4d4d50;
}
}
}
.ttl {
position: absolute;
top: 0; bottom: 0;
left: 0; right: 0;
margin: auto;
width: 980px; height: 40px;
color: #4d4d50;
font: 30px AvenirNext-Heavy;
text-align: center;
line-height: 40px;
}
View Compiled
class Header {
constructor(selector) {
const _handleScroll = () => {
this.setLeft(-window.scrollX);
};
this.elm = document.querySelector(selector);
window.addEventListener('scroll', _handleScroll);
}
setLeft(left) {
this.elm.style.left = `${left}px`;
}
}
new Header('.header');
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.