当前位置:网站首页>Achieve the effect of a menu tab
Achieve the effect of a menu tab
2022-07-29 10:25:00 【Phil Arist】
This small item is the effect of a side navigation menu , This is a very common function , With hidden display function , The purpose of this design , Mainly in some projects , We can save some page space , So that the page shows more content .
Now? , Let's take a look at the final effect of the project :

HTML Code :
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>【 Practice every day 】22— Achieve the effect of a menu tab </title>
</head>
<body>
<div class="navigation">
<ul>
<li class="list active">
<a href="#">
<span class="icon"><ion-icon name="home-outline"></ion-icon></span>
<span class="title"> home page </span>
</a>
</li>
<li class="list">
<a href="#">
<span class="icon"><ion-icon name="person-outline"></ion-icon></span>
<span class="title"> brief introduction </span>
</a>
</li>
<li class="list">
<a href="#">
<span class="icon"><ion-icon name="chatbubbles-outline"></ion-icon></span>
<span class="title"> news </span>
</a>
</li>
<li class="list">
<a href="#">
<span class="icon"><ion-icon name="settings-outline"></ion-icon></span>
<span class="title"> Set up </span>
</a>
</li>
<li class="list">
<a href="#">
<span class="icon"><ion-icon name="help-outline"></ion-icon></span>
<span class="title"> help </span>
</a>
</li>
<li class="list">
<a href="#">
<span class="icon"><ion-icon name="lock-closed-outline"></ion-icon></span>
<span class="title"> password </span>
</a>
</li>
<li class="list">
<a href="#">
<span class="icon"><ion-icon name="log-out-outline"></ion-icon></span>
<span class="title"> sign out </span>
</a>
</li>
</ul>
</div>
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
<script>
const list = document.querySelectorAll('.list');
function activelink(){
list.forEach((item) =>
item.classList.remove('active'));
this.classList.add('active');
}
list.forEach((item) =>
item.addEventListener('click', activelink));
</script>
</body>
</html>CSS Code :
{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body
{
min-height: 100vh;
background: #232c33;
display: flex;
justify-content: center;
align-items: center;
}
.navigation
{
position: relative;
height: 500px;
width: 70px;
box-sizing: initial;
border-left: 10px solid #2b343b;
box-shadow: 10px 0 0 #4187f6;
background: #2b343b;
transition: width 0.5s;
overflow-x: hidden;
}
.navigation:hover
{
width: 300px;
}
.navigation ul
{
position: absolute;
top: 0;
left: 0;
width: 100%;
padding-left: 5px;
padding-top: 40px;
}
.navigation ul li
{
position: relative;
list-style: none;
width: 100%;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.navigation ul li.active
{
background: #4187f6;
}
.navigation ul li a
{
position: relative;
display: block;
width: 100%;
display: flex;
text-decoration: none;
color: #fff;
}
.navigation ul li.active a
{
color: #fff;
}
.navigation ul li.active a::before
{
content: '';
position: absolute;
top: -30px;
right: 0;
width: 30px;
height: 30px;
background: #2b343b;
border-radius: 50%;
box-shadow: 15px 15px 0 #4187f6;
}
.navigation ul li.active a::after
{
content: '';
position: absolute;
bottom: -30px;
right: 0;
width: 30px;
height: 30px;
background: #2b343b;
border-radius: 50%;
box-shadow: 15px -15px 0 #4187f6;
}
.navigation ul li a .icon
{
position: relative;
display: block;
min-width: 60px;
height: 60px;
line-height: 70px;
text-align: center;
}
.navigation ul li a .icon ion-icon
{
position: relative;
font-size: 1.5em;
z-index: 1;
}
.navigation ul li a .title
{
position: relative;
display: block;
padding-left: 10px;
height: 60px;
line-height: 60px;
white-space: nowrap;
}At the end
The above is the whole content of daily practice , I hope today's little exercise is useful to you
边栏推荐
- [Yugong series] go teaching course 010 in July 2022 - Boolean and character types of data types
- 二次握手??三次挥手??
- Geeer's happiness | is for the white whoring image! Analysis and mining, NDVI, unsupervised classification, etc
- Are you familiar with the redis cluster principle of high paid programmers & interview questions series 122? How to ensure the high availability of redis (Part 2): cluster mechanism and principle, clu
- Performance optimization analysis tool | perf
- [wechat applet] interface generates customized homepage QR code
- ModuleNotFoundError: No module named ‘pywt‘解决方法
- 熊市下PLATO如何通过Elephant Swap,获得溢价收益?
- Science fiction style, standard 6 airbags, popular · yachts from 119900
- Two MySQL tables with different codes (utf8, utf8mb4) are joined, resulting in index failure
猜你喜欢

PDF处理还收费?不可能

Leetcode question brushing - sorting

MySQL 8 of relational database -- deepening and comprehensive learning from the inside out

Does neural network sound tall? Take you to train a network from scratch (based on MNIST)

"Focus on machines": Zhu Songchun's team built a two-way value alignment system between people and robots to solve major challenges in the field of human-computer cooperation

ECCV 2022 | CMU提出在视觉Transformer上进行递归,不增参数,计算量还少

Easy to understand and explain the gradient descent method!

Read Plato farm's eplato and the reason for its high premium

MySQL infrastructure: SQL query statement execution process

Hanyuan high tech Gigabit 2-optical 6-conductor rail managed Industrial Ethernet switch supports X-ring redundant ring network one key ring network switch
随机推荐
HMS Core Discovery第16期回顾|与虎墩一起,玩转AI新“声”态
SAP Fiori @OData. Analysis of the working principle of publish annotation
[IVI] 17.1 debugging pit FAQ (compilation)
Modulenotfounderror: no module named 'pywt' solution
Static resource mapping
leetcode刷题——排序
Selenium series 5-xpath path expression
How beautiful can VIM be configured?
On memory computing integrated chip technology
[fortran]vscode configure FORTRAN to run Hello World
Function - (C travel notes)
Functions and arrays
汉源高科千兆2光6电导轨式网管型工业级以太网交换机支持X-Ring冗余环网一键环网交换机
[semantic segmentation] 2021-pvt2 cvmj
SkiaSharp 之 WPF 自绘 弹动小球(案例版)
PDF处理还收费?不可能
[jetson][reprint]pycharm installed on Jetson
Second handshake?? Three waves??
DW: optimize the training process of target detection and more comprehensive calculation of positive and negative weights | CVPR 2022
Big cloud service company executives changed: technology gives way to sales