Cool CSS Menu Hover Effects - Using :before and :after pseudo element - Pure CSS Tutorial

preview_player
Показать описание
Please LIKE our Facebook page for daily updates...

Music Name : Spring In My Step by Silent Partner from YouTube Audio Library
Рекомендации по теме
Комментарии
Автор

CSS CODE:
body {
margin: 0;
padding:0;
font-family: sans-serif;
background: #151519;
}

ul {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
padding: 0;
display: flex;
}

ul li {
list-style: none;
}

ul li a {
position: relative;
display: block;
padding: 10px 20px;
margin: 20px 0;
text-decoration: none;
text-transform: uppercase;
color: #262626;
font-weight: bold;
transition: .5s;
}

ul li a:hover {
color: #fff;
}

ul li a:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
transform: scaleY(2);
opacity: 0;
transition: .5s;
z-index: -1;
}

ul li a:hover:before {
transform: scaleY(1.2);
opacity: 1;
}

ul li a:after {
content: '';
position: absolute;
top: 1px;
left: 0;
width: 100%;
height: 100%;
background: #000;
transform: scale(0);
transition: .5s;
z-index: -1;
}

ul li a:hover:after {
transform: scale(1);
}

ul li a {
color: white;
margin-left: 0;
}
HTML CODE: (I included other stuffs btw)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="ie=edge">
<title>Title Of your Tab Here</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div>
<ul>
<li><a href="Your link or file destination ex. Test.html">Text</a></li>
<li><a href="Your link or file destination ex. Test.html">Text</a></li>
<li><a href="Your link or file destination ex. Test.html">Text</a></li>
</ul>
**NOTE** You can add or lesser the links you want to go or write in.

nightcoreheaven
Автор

Dude!!! Your CSS skills are on whole new level <3 I truly wish that one day I'll be just as good as you

udaykulkarni
Автор

Hello, I have a question because there are elements to which you position without applying the properties of top, left, right, bottom?

wistongramirez
Автор

Helped me figure out I need to add transition to the original item rather than apply some :after styling, thanks!

joeybertschler
Автор

Pls is you code is not clear to read can you project ot big size thnx

umarsandaahmed
Автор

Plz give some explanation...
Anyway awesome video...

sivamuruganandamj
Автор

Attractive Nav ...Any animation or any page make always responsive

Santoshumnekar
Автор

Cool, I learn lot about after, before ans scale transform. Thanks for great tutorial

janitholagama
Автор

So nice bro how you can remember these properties can help or you written on the paper?

shahzaib
Автор

Thanks a lot for all your videos.👍👍👍👍👍👍👍👍👍

kandi
Автор

But, it would be so better if you place those 2 screens side by side, So that we could watch the changes too....please consider this!

muralikrishna
Автор

I like your channel, but I hate this specific music, it's everywhere on youtube

anisdhouieb
Автор

So can anyone tell me what is z-index? And why that text colored changed after using z-index?

Its_Pritam_
Автор

SIR BEFORE OR AFTEER KY SATH SAI KHELA HY GREAT SIR KAMAL

azeemsaleem
Автор

Sir plzzz explain us it would be much better

bipulsantosh
Автор

Very good thanks for this tutorial
But this exemple is not respensive

irinabella