当前位置:网站首页>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
边栏推荐
- Object storage
- 一文读懂Plato Farm的ePLATO,以及其高溢价缘由
- 云服务大厂高管大变阵:技术派让位销售派
- How can Plato obtain premium income through elephant swap in a bear market?
- Skiasharp's WPF self drawn bouncing ball (case version)
- Science fiction style, standard 6 airbags, popular · yachts from 119900
- How beautiful can VIM be configured?
- MySQL 8 of relational database -- deepening and comprehensive learning from the inside out
- Orbslam2 installation test and summary of various problems
- ECCV 2022 | CMU proposes to recurse on the visual transformer without adding parameters, and the amount of calculation is still small
猜你喜欢

This is an incomplete data competition Yearbook!
![[Yugong series] go teaching course 010 in July 2022 - Boolean and character types of data types](/img/3c/eaadcc105377f012db5ee8852b5e28.png)
[Yugong series] go teaching course 010 in July 2022 - Boolean and character types of data types

可线性渐变的环形进度条的实现探究

Turn the evolutionary path of push

皕杰报表之文本附件属件

ECCV 2022 | CMU proposes to recurse on the visual transformer without adding parameters, and the amount of calculation is still small

Understanding of Arduino circuit
![[jetson][转载]jetson上安装pycharm](/img/65/ba7f1e7bd1b39cd67018e3f17d465b.png)
[jetson][转载]jetson上安装pycharm

电竞入亚后,腾讯要做下一个“NBA赛事捕手”?

Vim到底可以配置得多漂亮?
随机推荐
Second handshake?? Three waves??
Yin Yi: my learning and growth path
[FPGA tutorial case 19] factorial operation through multiplier
What is "enterprise level" low code? Five abilities that must be possessed to become enterprise level low code
可线性渐变的环形进度条的实现探究
Implementation of college logistics repair application system based on SSM
【论文阅读】I-BERT: Integer-only BERT Quantization
MySQL infrastructure: SQL query statement execution process
Tips of Day1 practice in 2022cuda summer training camp
mosquitto_sub -F 参数使用
Modulenotfounderror: no module named 'pywt' solution
MySQL optimization theory study guide
Turn the evolutionary path of push
Selenium series 5-xpath path expression
Uniswap entered the NFT trading market and opensea took the lead
10 suggestions for 10x improvement of application performance
[fortran]vscode配置fortran跑hello world
Intel joins hands with datawhale to launch learning projects!
Summary of JD internship written examination questions
This developer, who has been on the list for four consecutive weeks, has lived like a contemporary college student