Why does my CSS Transition depend on zoom and resolution? - css

I've been struggling for a while with an animation that always seems to be inaccurate despite many attempts to fix it.
I would like a "minus" symbol to turn into a "plus" on the hover event. The rotation of the minus happens but the two lines (vertical and horizontal) never seem to be centered and at the end of the animation the vertical line adds some pixels seeming slightly wider than when it was horizontal. Changing resolution or zooming changes the geometry of the vertical line. The vertical line is not centered or becomes more "fat".
What I am looking for is a perfect animation that is independent of resolution and various imperfections.
On Codepen I reported the relevant code, try to play with it a little.
HTML:
<div>
<a class="n-button button-flat n-button-default-size button-default button-1 n-button-default-span n-button-default-type" target="_self" href="#" style="margin-left:124px;">
<i class="fa-minus fas button-icon-left" aria-hidden="true"></i><span class="n-button-text">Guarda cosa facciamo</span>
</a>
</div>
CSS:
* {
box-sizing: border-box;
}
body {
background-color: black;
--button-border-radius-top-left: 0px;
--button-border-radius-top-right: 0px;
--button-border-radius-bottom-right: 0px;
--button-border-radius-bottom-left: 0px;
margin: 0;
color: #747474;
min-width: 320px;
-webkit-text-size-adjust: 100%;
font: 13px/20px PTSansRegular,Arial,Helvetica,sans-serif;
}
.n-button.button-1{
border-radius:0px 0px 0px 0px;
}
.n-button{
outline: 0;
display: inline-block;
position: relative;
text-align: center;
text-decoration: none;
cursor: pointer;
box-sizing: border-box;
font-family: var(--button_typography-font-family);
font-weight: var(--button_typography-font-weight);
font-style: var(--button_typography-font-style,normal);
letter-spacing: var(--button_typography-letter-spacing);
border-width: var(--button_border_width-top,0) var(--button_border_width-right,0) var(--button_border_width-bottom,0) var(--button_border_width-left,0);
border-style: solid;
border-radius: var(--button-border-radius-top-left,0) var(--button-border-radius-top-right,0) var(--button-border-radius-bottom-right,0) var(--button-border-radius-bottom-left,0);
text-transform: var(--button_text_transform);
transition: all .2s;
}
.n-button.button-flat {
box-shadow: none!important;
}
.n-button-default-size, button.button {
padding-top: var(--button_padding-top,13px);
padding-right: var(--button_padding-right,29px);
padding-bottom: var(--button_padding-bottom,13px);
padding-left: var(--button_padding-left,29px);
line-height: var(--button_line_height, 1);
font-size: var(--button_font_size, 14px);
}
.button-default{
background: var(--button_gradient_top_color);
color: var(--button_accent_color);
border-color: var(--button_border_color);
}
a{
transition-property: color,background-color,border-color;
transition-duration: .2s;
transition-timing-function: linear;
}
div{
margin: 20px;
}
/*************/
.fa-minus:before {
top: 0;
position: absolute;
}
.fa-minus.fas.button-icon-left{
margin-right: 30px;
}
.fa-minus.fas.button-icon-left, .icon-minus.button-icon-left {
color: #f3ad00 !important;
}
a:hover .fa-minus.fas.button-icon-left:before{
content: "\f068";
top: 0;
position: absolute;
margin-right: 30px;
}
.n-button i, .n-button-text {
transition: all 1s cubic-bezier(0.66, 0.01, 0, 1.07) 0s;
}
.fa-minus.fas.button-icon-left:after {
content: "\f068";
display: block;
position: absolute;
transition : all 1s cubic-bezier(0.66, 0.01, 0, 1.07) 0s;
top: 0
}
a:hover .fa-minus.fas.button-icon-left:after {
content: "\f068";
transform: rotate(90deg);
transition: all 1s cubic-bezier(0.66, 0.01, 0, 1.07) 0s;
}
:root {
--button_padding-top: 0px;
--button_padding-bottom: 10px;
--button_padding-left: 0px;
--button_padding-right: 0px;
--button_typography-font-family: Montserrat, Arial, Helvetica, sans-serif;
--button_typography-font-weight: 400;
--button_typography-letter-spacing: 0px;
--button_font_size: 18px;
--button_line_height: 20px;
--button_text_transform: none;
--button_gradient_top_color: rgba(255,255,255,0);
--button_gradient_top_color_hover: rgba(255,255,255,0);
--button_accent_color: rgba(255,255,255,0.69);
--button_border_width-top: 0px;
--button_border_width-right: 0px;
--button_border_width-bottom: 0px;
--button_border_width-left: 0px;
--button_border_color: rgba(255,255,255,0);
--button_padding: 11px 23px;
}
Many thanks in advance

Related

How would I automatically adjust the width of the dropdown content to match the width of the <p> element?

Basically, I have two <p> elements. When you hover over one <p> element, the dropdown content appears. The problem is, I want the dropdown content (the dropdown itself)'s width to match the width of the <p> element. These images should probably describe what I'm talking about. The red line I drew on the first image is what I would like to "cut off" or resize so it fits perfectly under the text.
Here is the code:
#dropdown {
display: inline-block;
position: relative;
text-align: center;
}
#dropdown p {
color: #262261;
font-family: 'Work Sans', sans-serif;
font-size: 35px;
letter-spacing: 5px;
margin: auto auto auto auto;
}
#dropdown-content {
position: absolute;
margin: 10px auto auto auto;
height: auto;
min-width: 300px;
opacity: 0;
transition: all .2s ease-in;
background-color: #262261;
border-radius: 8px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.nav-dropdown-container {
width: 400px;
}
#dropdown-content p {
font-size: 20px;
font-family: 'Work Sans', sans-serif;
font-size: 30px;
letter-spacing: 2px;
transition: 0.5s;
}
#dropdown:hover #dropdown-content {
opacity: 1;
line-height: 2;
padding-top: 1em;
padding-bottom: 1em;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
#dropdown-link:link {
color: #FFFFFF;
display: block;
text-decoration: none;
}
<div id="applications">
<div class="nav-dropdown-container">
<div id="dropdown">
<p>APPLICATIONS</p>
<div id="dropdown-content">
<center>
<p><a id="dropdown-link" href="pages/nami.html">abc</a></p>
<p><a id="dropdown-link" href="pages/jammr.html">def</a></p>
</center>
</div>
</div>
</div>
I really do not want to do this manually, I want this done automatically. Please, let me know if this is possible. Again, it's hard for me to explain what I would like done so I did my best. Thank you!
Simply use left:0;right:0; with the positon:absolute element and remove all the width definition. The inline-block will make the width fit the content:
And get rid of the center tag.
#dropdown {
display: inline-block;
position: relative;
text-align: center;
}
#dropdown p {
color: #262261;
font-family: 'Work Sans', sans-serif;
font-size: 35px;
letter-spacing: 5px;
margin: auto auto auto auto;
}
#dropdown-content {
position: absolute;
left: 0;
right: 0;
margin: 10px auto auto;
text-align: center;
opacity: 0;
transition: all .2s ease-in;
background-color: #262261;
border-radius: 8px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
#dropdown-content p {
font-size: 20px;
font-family: 'Work Sans', sans-serif;
font-size: 30px;
letter-spacing: 2px;
transition: 0.5s;
}
#dropdown:hover #dropdown-content {
opacity: 1;
line-height: 2;
padding-top: 1em;
padding-bottom: 1em;
transition: all 0.5s ease-in-out;
}
#dropdown-link:link {
color: #FFFFFF;
display: block;
text-decoration: none;
}
<div id="dropdown">
<p>APPLICATIONS</p>
<div id="dropdown-content">
<p><a id="dropdown-link" href="pages/nami.html">abc</a></p>
<p><a id="dropdown-link" href="pages/jammr.html">def</a></p>
</div>
</div>
<div id="dropdown">
<p>extention</p>
<div id="dropdown-content">
<p><a id="dropdown-link" href="pages/nami.html">abc</a></p>
<p><a id="dropdown-link" href="pages/jammr.html">def</a></p>
</div>
</div>

position:fixed moves on mobile scroll

I'm working on a website where on certain pages I want to have a fixed bar on the top of the page. On mobile this functions but when the finger is released from screen the bar moves away from the screen.
I've been using position:fixed;, top:0; and display:block;
Is there any way to fix this?
I've been twisting my brains around it for the last couple of days but can't seem to get it working.
[edit; In this
/* Basic CSS */
#offcanvas-menu {
z-index: 99999;
}
.banner {
position: fixed;
padding: 0;
overflow: hidden;
z-index: auto;
border-bottom-width: 0.13vw;
border-color: #000000;
border-bottom-style: solid;
}
.banner_inner {
width: 100%;
white-space: nowrap;
margin-bottom: 0;
margin-top: 0.3%;
cursor: pointer;
}
.banner {
bottom: 0;
left: 0;
width: 100vw;
background-color: white;
translateY(100%);
transform-origin: left bottom;
z-index: 102;
cursor: pointer;
}
/* main text in bar */
#banner-inner {
margin-left: 1.5%;
margin-top: 1.5%;
min-height: 144px;
position: relative;
}
#banner-row-1 {
width: 15vw;
margin-right: 1.5%;
display: inline-block;
position: absolute;
}
#banner-row-2 {
width: 15vw;
margin-right: 1.5%;
position: absolute;
display: inline-block;
left: 17.7vw;
}
#banner-row-3 {
width: 46.02vw;
margin-right: 1.5%;
position: absolute;
display: inline-block;
left: 34.18740849194729vw;
}
#banner-row-3 p6 {
font-family: helvetica, sans-serif;
font-weight: 300;
color: black;
font-size: 1.39vw;
line-height: 1.2;
}
a4 {
font-family: helvetica, sans-serif;
font-weight: 300;
color: black;
font-size: 1.39vw;
line-height: 1.2;
}
a5 {
font-family: helvetica, sans-serif;
font-weight: 300;
color: black;
font-size: 1.39vw;
line-height: 1.2;
margin-left: 5%;
}
#banner h4 {
font-family: helvetica, sans-serif;
color: #000000;
font-size: 3.2vw;
letter-spacing: 0em;
line-height: 1.2;
font-weight: 300;
text-align: left;
display: inline-block;
margin-left: 1.5%;
margin-top: 1.2vw;
margin-bottom: 1.2vw;
width: 31.5vw;
}
#banner h5 {
font-family: helvetica, sans-serif;
color: #000000;
font-size: 3.2vw;
letter-spacing: 0em;
line-height: 1.2;
font-weight: 300;
text-align: left;
display: inline-block;
left: 34.18740849194729vw;
margin-top: 1.2vw;
margin-bottom: 1.2vw;
margin-left: 1.5%;
width: 46.02vw;
}
#banner h6 {
font-family: helvetica, sans-serif;
color: #000000;
font-size: 3.2vw;
letter-spacing: 0em;
line-height: 1.2;
font-weight: 300;
text-align: left;
display: inline-block;
left: 34.18740849194729vw;
margin-top: 1.2vw;
margin-bottom: 1.2vw;
margin-left: 1.5%;
width: 15.1vw;
}
/* left */
nav#offcanvas-menu {
/* Full screen nav menu */
width: 100vw;
height: 29.5vw;
/* this is for browsers that don't support CSS3 translate3d */
-moz-transform: translate3d(0, -23.3vw, 0);
-webkit-transform: translate3d(0, -23.3vw, 0);
transform: translate3d(0, -23.3vw, 0);
}
nav#offcanvas-menu {
left: 0vw;
}
/* off canvas sidebar left right */
div#main-region {
position: relative;
width: 100%;
-moz-transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-moz-transition: -moz-transform 0.5s;
/* transition settings */
-webkit-transition: -webkit-transform 0.5s;
transition: transform 0.5s;
}
/*SIDEBAR LEFT*/
input[type="checkbox"]#togglebox {
/* checkbox used to toggle menu state */
position: absolute;
left: 0;
top: 0;
visibility: hidden;
}
nav#offcanvas-menu label#closex {
/* Large x close button inside nav */
width: 100vw;
height: 100vh;
overflow: hidden;
display: block;
position: absolute;
cursor: pointer;
text-indent: -10000px;
line-height: 1.1;
z-index: 10;
top: 0;
right: 0;
}
input[type="checkbox"]#togglebox:checked~nav#offcanvas-menu {
/* nav state when corresponding checkbox is checked */
-moz-transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
-moz-transition-delay: 0s;
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
nav#offcanvas-menu {
top: 0;
z-index: 104;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: white;
display: block;
position: fixed;
color: white;
overflow: auto;
-moz-transition: -moz-transform 0.5s, visibility 0s 0.5s;
/* transition settings */
-webkit-transition: -webkit-transform 0.5s, visibility 0s 0.5s;
transition: transform 0.5s, visibility 0s 0.5s;
}
<label for="togglebox">
</label>
<input type="checkbox" id="togglebox" />
<nav id="offcanvas-menu">
<label for="togglebox" id="closex">×</label>
<label for="togglebox">
<div id="banner-inner">
<div id="banner-row-1">
<a4>Client</a4><br>
<a5>Client name</a5><br><br>
<a4>Year</a4><br>
<a5>2016</a5><br><br>
<a4>Collaboration</a4><br>
<a5>Name Person</a5>
</div>
<div id="banner-row-2">
<a4>Specifications</a4><br>
<a5>specifications</a5>
</div>
<div id="banner-row-3">
<p6>piece of text<p6><br><br>
<p6>piece of text</p6>
</div>
</div>
<div class="banner" id="banner">
<h4>Titel project</h4>
<h5>Identity, Typography, Web</h5>
<h6>↓ Info</h6>
</div>
</label>
</nav>
<br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br>
You need to remove the translate3d from one of the parents (div#main-region), or else your position fixed will be based on that translate3d parent

CSS: How do I make the lines in this hover effect stay with the word inside of it?

This is my modification of someone else's hover effect. So I am not familiar with the working of btn-2 class.(I don't know the syntax used)
Here is my CSS code:
* {
box-sizing: inherit;
transition-property: all;
transition-duration: .6s;
transition-timing-function: ease;
}
body {
background-color: black;
}
a {
text-decoration: none;
color: tomato;
font-size: 50px;
font-family: 'Oswald', sans-serif;
}
.container {
padding: 1em;
text-align: center;
vertical-align: middle;
}
.btn-2 {
letter-spacing: 10px;
}
.btn-2:hover,
.btn-2:active {
letter-spacing: 30px;
}
.btn-2:after,
.btn-2:before {
border: 1px solid rgba(tomato, 0);
bottom: 2px;
top: 2px;
content: " ";
display: block;
margin: 0 auto;
position: relative;
transition: all 280ms ease-in-out;
width: 0;
}
.btn-2:hover:after,
.btn-2:hover:before {
backface-visibility: hidden;
border-color: tomato;
transition: width 350ms ease-in-out;
width: 50%;
}
.btn-2:hover:before {
bottom: auto;
top: 0;
width: 50%;
}
I want to use the effect for button in my navigation bar. But I have 3 problems to solve:
I want the lines above and below the word that appear when you hover it to be of the same width as the word.
I want the word to be centered relative to the line. That is, the line should grow out from the middle point of the word.
The lines isn't going where the word is going.
Some discoveries I make, which I don't know the cause of:
The 2 lines will be longer when .comtainer{padding=1em} than 5em.
When I delete text-align and vertical-align in the .container class, the hovering lines stay centered, but the word goes to the left of the window.
I'm not sure how good I understand you, but here some example I made
a {
color: #333;
display: inline-block;
padding: 15px 0;
position: relative;
text-align: center;
text-decoration: none;
transition: all 250ms ease-in-out;
&:before,
&:after{
content: '';
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
width: 0;
height: 2px;
background-color: #333;
transition: all 250ms ease-in-out;
}
&:before {
top:0;
}
&:after {
bottom: 0;
}
&:hover {
letter-spacing: 5px;
&:before,
&:after {
width: 100%;
}
}
//Trick is here
span {
&:before {
content:attr(title);;
letter-spacing: 5px;
display:block;
height:1px;
color:transparent;
overflow:hidden;
visibility:hidden;
margin-bottom:-1px;
}
}
}
<span title="Hover Me">Hover Me</span>
You can check my example here

Transform Scale Causing Gaps/Lines

I'm building a website currently and am experiencing issues with transform: scale. I've got a button, and when a user hovers over it, two things happen:
A background "sweeps" in diagonally
The button label colour changes
The button grows slightly
I have got this working, and it looks really nice, but after implementing point 3, I'm seeing a weird gap to the left hand side when the button grows.
Here is my code: click for demo
HTML
Hover
CSS
body {
text-align: center;
padding-top: 10%;
}
.button {
display: inline-block;
text-transform: uppercase;
font-size: 1.1em;
font-weight: 600;
background: transparent;
transition: all ease .25s;
border: 3px solid green;
color: green;
position: relative;
overflow: hidden;
z-index: 2;
font-family: sans-serif;
padding: 20px 35px;
text-decoration: none;
}
.button:before {
content: ' ';
transition: all ease-out .25s;
width: 200%;
height: 100%;
position: absolute;
top: 0;
left: 0;
transform-origin: 0 0;
z-index: -1;
transform: skewX(-45deg) translateX(-100%);
background: green;
}
.button:hover:before {
transform: translateX(0);
}
.button:hover {
color: white;
transform: scale(1.1);
}
And here's a screenshot of the gap I'm seeing. This issue occurs in Chrome and Safari (I haven't tested Firefox or IE as I can't download them at work).
Screenshot of weird gap
It "only" appears in Chrome but not Firefox (edit: worse in Edge: first it's on the left then on bottom...). Not sure if a rounding error or something else is the cause of that gap, but I find that replacing border by a box-shadow improves the rendering.
There's still a gap that can be seen near the end of the transition but finally disappears so I added 2 box-shadows on :hover: the new one is inset and fills the gap between "border/box-shadow" and content box faster.
Codepen: http://codepen.io/PhilippeVay/pen/oYjZzK?editors=0100
body {
text-align: center;
padding-top: 10%;
}
.button {
display: inline-block;
text-transform: uppercase;
font-size: 1.1em;
font-weight: 600;
background: transparent;
transition: all ease .25s;
box-shadow: 0 0 0 3px green; /* replaces border which caused a gap in Chr, not Fx */
color: green;
position: relative;
overflow: hidden;
z-index: 2;
font-family: sans-serif;
padding: 19px 34px;
text-decoration: none;
}
.button:before {
content: ' ';
transition: transform ease-out .25s;
width: 200%;
height: 100%;
position: absolute;
top: 0;
left: 0;
transform-origin: 0 0;
z-index: -1;
transform: skewX(-45deg) translateX(-100%);
background: green;
}
.button:hover:before {
transform: translateX(0);
}
.button:hover {
color: white;
box-shadow: 0 0 0 3px green, inset 0 0 0 1px green; /* improves end of transition in Chrome */
transform: scale(1.1);
}
Hover
EDIT: playing with the size of the transitioned :pseudo
.button:before {
content: ' ';
transition: all ease-out .25s;
width: calc(200% + 6px);
height: calc(100% + 6px);
position: absolute;
top: -3px;
left: -3px;
transform-origin: 0 3px;
z-index: -1;
transform: skewX(-45deg) translateX(-100%);
background: green;
}
to take into account the border but that doesn't change anything because of overflow: hidden.
So here's my third try: by adding a container (or having the A element as a container) and keeping the border on the child element, it makes that gap disappear (overflow is around the border).
Codepen: http://codepen.io/PhilippeVay/pen/ZBbKWd
body {
text-align: center;
padding-top: 10%;
}
a {
display: inline-block;
overflow: hidden;
background: transparent;
transition: all ease .25s;
color: green;
position: relative;
z-index: 2;
font-family: sans-serif;
text-decoration: none;
}
a > span {
display: inline-block;
text-transform: uppercase;
font-size: 1.1em;
font-weight: 600;
border: 3px solid green;
padding: 20px 35px;
}
a:before {
content: ' ';
transition: all ease-out .25s;
width: 200%;
height: 100%;
position: absolute;
top: 0;
left: 0;
transform-origin: 0 0;
z-index: -1;
transform: skewX(-45deg) translateX(-100%);
background: green;
}
a:hover:before {
transform: translateX(0);
}
a:hover {
color: white;
transform: scale(1.1);
}
<span class="bd">Hover</span>
Fx transitions till the end flawlessly... and "corrects" the width by adding 2px on the right. But it's already visible in your jsbin so it's another story (and less annoying I guess as user will have clicked by then imho)

Clip-path doesn't work in Firefox and IE

I have a nav element that on mouse hover reveal my menu, it works fine on Safari and Chrome however not in Firefox nor in IE:
/* start nav menu morph */
nav {
width: 23%;
background: #222222;
color: rgba(255, 255, 255, 0.87);
-webkit-clip-path: circle(16px at 30px 24px);
clip-path: circle(16px at 30px 24px);
-webkit-transition: -webkit-clip-path 0.5625s, clip-path 0.375s;
transition: -webkit-clip-path 0.5625s, clip-path 0.375s;
}
nav:hover {
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
-webkit-transition-duration: 0.75s;
transition-duration: 0.75s;
-webkit-clip-path: circle(500px at 225px 24px);
clip-path: circle(500px at 225px 24px);
}
nav a {
width: 100%;
display: block;
line-height: 50px;
padding: 0 20px;
color: inherit;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
nav a:hover {
background: #ffe082;
}
nav a:active {
background: #ffca28;
}
.nav-sim {
position: absolute;
right: 0;
top: -6px;
}
.navicon {
padding: 23px 20px;
cursor: pointer;
-webkit-transform-origin: 32px 24px;
-ms-transform-origin: 32px 24px;
transform-origin: 32px 24px;
}
.navicon div {
position: relative;
width: 20px;
height: 2px;
background: rgb(254, 70, 70);
}
.navicon div:before,
.navicon div:after {
display: block;
content: "";
width: 20px;
height: 2px;
background: rgb(254, 70, 70);
position: absolute;
}
.navicon div:before {
top: -7px;
}
.navicon div:after {
top: 7px;
}
.fa-sim {
font-size: large;
margin-left: 5px;
}
/* end nav menu morph */
<noscript>
<style>
#navmenusim {
display: none;
}
</style>
</noscript>
<nav class="nav-sim" id="navmenusim">
<div class="navicon">
<div></div>
</div>
Home<i class="fa fa-home icon i-sim fa-sim"></i>
Blog<i class="fa fa-rss icon i-sim fa-sim"></i>
Contact<i class="fa fa-mail icon i-sim fa-sim"></i>
</nav>
The menu in Firefox and IE is always visible, the clip-path doesn't work. How to fix it?
As mentioned in my comment to the question, CSS clip-path won't work in Firefox. You would need to use SVG along with url() syntax for Firefox support. IE (even 11 and Edge) supports neither the CSS or SVG version of clip-path. You can check browser compatibility chart at Can I Use.
You can make use of the max-width, max-height, border-radius and overflow properties to sort of get a similar output to what you need. Below is a sample snippet which should work in all browsers.
/* start nav menu morph */
nav {
margin-top: 10px;
width: 23%;
background: #222222;
color: rgba(255, 255, 255, 0.87);
max-height: 50px;
max-width: 50px;
border-radius: 50%;
overflow: hidden;
transition: max-height .375s, max-width .375s, border-radius .125s .25s;
}
nav:hover {
max-height: 500px;
max-width: 500px;
border-radius: 0%;
transition: max-height .75s ease-out, max-width .75s ease-out, border-radius .75s ease-out;
}
nav a {
width: 100%;
display: block;
line-height: 50px;
padding: 0 20px;
color: inherit;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
nav a:hover {
background: #ffe082;
}
nav a:active {
background: #ffca28;
}
.nav-sim {
position: absolute;
right: 0;
top: -6px;
}
.navicon {
padding: 23px 20px;
cursor: pointer;
-webkit-transform-origin: 32px 24px;
-ms-transform-origin: 32px 24px;
transform-origin: 32px 24px;
}
.navicon div {
position: relative;
margin-left: -5px;
width: 20px;
height: 2px;
background: rgb(254, 70, 70);
}
.navicon div:before,
.navicon div:after {
display: block;
content: "";
width: 20px;
height: 2px;
background: rgb(254, 70, 70);
position: absolute;
}
.navicon div:before {
top: -7px;
}
.navicon div:after {
top: 7px;
}
.fa-sim {
font-size: large;
margin-left: 5px;
}
/* end nav menu morph */
<nav class="nav-sim" id="navmenusim">
<div class="navicon">
<div></div>
</div>
Home<i class="fa fa-home icon i-sim fa-sim"></i>
Blog<i class="fa fa-rss icon i-sim fa-sim"></i>
Contact<i class="fa fa-mail icon i-sim fa-sim"></i>
</nav>

Resources