.oop
.header
h1.heading Pure CSS Navigation
br
small Simple & Easy, Scroll down to view
.mobile
.mobile-body
.navbar
div.logo
a(href="#") Grey Shades
button(type="button", class="burger")
span
span
span
ul.menu
li Home
li Work
li About
li Contact Me
.container
h2 The Elephant Rope
p As a man was passing the elephants, he suddenly stopped, confused by the fact that these huge creatures were being held by only a small rope tied to their front leg. No chains, no cages. It was obvious that the elephants could, at anytime, break away from their bonds but for some reason, they did not.
p He saw a trainer nearby and asked why these animals just stood there and made no attempt to get away. “Well,” trainer said, “when they are very young and much smaller we use the same size rope to tie them and, at that age, it’s enough to hold them. As they grow up, they are conditioned to believe they cannot break away. They believe the rope can still hold them, so they never try to break free.”
p The man was amazed. These animals could at any time break free from their bonds but because they believed they couldn’t, they were stuck right where they were.
p Like the elephants, how many of us go through life hanging onto a belief that we cannot do something, simply because we failed at it once before?
p Failure is part of learning; we should never give up the struggle in life.
View Compiled
* {
&, &:before, &:after {
moz-box-sizing: border-box;
box-sizing: border-box;
}
}
@import url('https://fonts.googleapis.com/css?family=Inconsolata');
body {
font-family: "Inconsolata", sans-serif;
font-size: 14px;
padding: 0 0 40px 0;
margin: 0;
}
.mobile {
width: 2.35in;
height: 4.87in;
margin: 0 auto;
background: #222;
border-radius: 25px;
padding: 50px 5px;
box-shadow: 0px 30px 40px rgba(0,0,0,0.2);
.mobile-body {
background: #fff;
height: 100%;
padding-top: 40px;
// box-shadow: inset 0px 0px 2px rgba(0,0,0,1);
border-radius: 4px;
position: relative;
}
}
.container {
overflow-y: scroll;
height: 327px;
padding: 5px;
background: #f6f6f6;
line-height: 1.4;
&::scrollbar {
width: 5px;
}
&::scrollbar-track {
box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
}
&::scrollbar-thumb {
border-radius: 10px;
box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
}
// no of use
.oop {
position: relative;
z-index: auto;
height: 10px;
background: linear-gradient(141deg, #48ded4 0%, #a026bf 51%, #e82c75 75%);
margin-bottom: 20px;
}
.header {
height: 100vh;
display: table;
width: 100%;
}
.heading {
display: table-cell;
vertical-align: middle;
font-size: 2.3em;
letter-spacing: 5px;
text-align: center;
font-weight: 200;
text-transform: uppercase;
color: #333;
position: relative;
small {
font-size: 50%;
}
}
// navbar styles
.navbar {
background: #fff;
border-radius: 4px;
position: absolute;
top: 0;
left: 0;
right: 0;
box-shadow: 0px 1px 6px rgba(0,0,0,0.2);
width: 100%;
.logo {
padding: 12px 5px 12px 35px;
a {
text-decoration: none;
color: #333;
font-size: 1em;
}
}
// instead button you can use checkbox to toggle menu with same click. I'm using button focus state to open the menu.
button.burger {
position: absolute;
left: 0;
top: 0;
border: 0;
background: transparent;
padding: 8px 15px;
pointer: cursor;
outline: none;
span {
display: block;
width: 4px;
height: 4px;
background: #000;
margin: 3px 0;
border-radius: 4px;
transition: all .4s ease-in-out;
}
// Rotate first and last span
&:focus {
span:first-child {
transform-origin: 2px 9px;
transform: rotate(-90deg);
}
span:last-child {
transform-origin: 2px -5px;
transform: rotate(-90deg);
}
}
&:focus + ul {
max-height: 500px;
}
}
// nav menu
ul.menu {
list-style: none;
padding: 0;
margin: 0;
overflow: hidden;
max-height: 0;
transition: all 0.6s ease-in-out;
> li {
display: block;
padding: 10px 15px;
transition: all 0.2s ease;
&:hover {
background: linear-gradient(141deg, #48ded4 0%, #a026bf 51%, #e82c75 75%);
color: #fff;
}
}
}
}
// feel free to modify. Thanks for watching :)
View Compiled
// no JS
This Pen doesn't use any external CSS resources.