前端css--导航栏效果

news2024/9/24 17:14:53

效果如下:
在这里插入图片描述

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>导航栏动态效果</title>
  <link rel="stylesheet" href="./style/style.css">
</head>
<body>
  <h1>导航栏动态效果</h1>
<nav>
  <ul class="main">
    <li>
      <a href="#">Home</a>
      <ul class="drop menu1">
        <li><a href="#">Home</a></li>
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">about</a></li>
      </ul>
    </li>
    <li><a href="#">news</a>
      <ul class="drop menu2">
        <li><a href="#">Home</a></li>
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">about</a></li>
      </ul>
    </li>
    <li><a href="#">contact</a>
      <ul class="drop menu3">
        <li><a href="#">Home</a></li>
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">about</a></li>
      </ul>
    </li>
    <li><a href="#">works</a>
      <ul class="drop menu4">
        <li><a href="#">Home</a></li>
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">about</a></li>
      </ul>
    </li>
    <li><a href="#">team</a>
      <ul class="drop menu5">
        <li><a href="#">Home</a></li>
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">about</a></li>
      </ul>
    </li>
    <li><a href="#">about</a>
      <ul class="drop menu6">
        <li><a href="#">Home</a></li>
        <li><a href="#">news</a></li>
        <li><a href="#">contact</a></li>
        <li><a href="#">about</a></li>
      </ul>
    </li>
  </ul>
</nav>
</body>

</html>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1e1e1e;
    background-size: cover;
    height: 100vh;
    font-family: "Raleway", sans-serif;
    letter-spacing: 1px;
}

h1 {
    text-align: center;
    color: #fff;
    padding-top: 20px;
}

ul {
    list-style: none;
}

nav {
    height: 40px;
    margin: 40px auto;
    background-color: rgba(23, 23, 50, 0.7);
    text-align: center;
    border-radius: 4px;
}

.main {
    display: flex;
    justify-content: center;
}

.main>li {
    margin: 0 2%;
}

.main>li a {
    border-left: 1px solid rgba(23, 23, 50, 1);
}

a {
    text-decoration: none;
    color: #ffe;
    text-transform: capitalize;
    font-family: monospace;
    display: block;
    padding: 10px 15px;
    font-size: 16px;
    transition: background-color 0.5s ease-in-out;
    font-family: "Raleway", sans-serif;
}

a:hover {
    background-color: #631818;
}

.drop li {
    opacity: 0;
    transform-origin: top center;
}

.drop li a {
    background-color: rgba(23, 23, 50, 0.7);
    padding: 10px 0;
}


/*------------- menu1 animation -------------------*/

.main li:hover .menu1 li:first-of-type {
    animation: menu1 0.3s ease-in-out forwards;
    animation-delay: 0.3s;
}

.main li:hover .menu1 li:nth-of-type(2) {
    animation: menu1 0.3s ease-in-out forwards;
    animation-delay: 0.6s;
}

.main li:hover .menu1 li:nth-of-type(3) {
    animation: menu1 0.3s ease-in-out forwards;
    animation-delay: 0.9s;
}

.main li:hover .menu1 li:last-of-type {
    animation: menu1 0.3s ease-in-out forwards;
    animation-delay: 1.2s;
}

@keyframes menu1 {
    from {
        opacity: 0;
        transform: translateX(30px) rotateY(90deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) rotateY(0);
    }
}


/*------------- menu2 animation -------------------*/

.main li:hover .menu2 li:first-of-type {
    animation: menu2 0.3s ease-in-out forwards;
    animation-delay: 0.3s;
}

.main li:hover .menu2 li:nth-of-type(2) {
    animation: menu2 0.3s ease-in-out forwards;
    animation-delay: 0.6s;
}

.main li:hover .menu2 li:nth-of-type(3) {
    animation: menu2 0.3s ease-in-out forwards;
    animation-delay: 0.9s;
}

.main li:hover .menu2 li:last-of-type {
    animation: menu2 0.3s ease-in-out forwards;
    animation-delay: 1.2s;
}

@keyframes menu2 {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}


/*------------- menu3 animation -------------------*/

.main li:hover .menu3 li:first-of-type {
    animation: menu3 0.3s ease-in-out forwards;
    animation-delay: 0.3s;
}

.main li:hover .menu3 li:nth-of-type(2) {
    animation: menu3 0.3s ease-in-out forwards;
    animation-delay: 0.6s;
}

.main li:hover .menu3 li:nth-of-type(3) {
    animation: menu3 0.3s ease-in-out forwards;
    animation-delay: 0.9s;
}

.main li:hover .menu3 li:last-of-type {
    animation: menu3 0.3s ease-in-out forwards;
    animation-delay: 1.2s;
}

@keyframes menu3 {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}


/*------------- menu4 animation -------------------*/

.main li:hover .menu4 li:first-of-type {
    animation: menu4 0.3s ease-in-out forwards;
    animation-delay: 0.3s;
}

.main li:hover .menu4 li:nth-of-type(2) {
    animation: menu4 0.3s ease-in-out forwards;
    animation-delay: 0.6s;
}

.main li:hover .menu4 li:nth-of-type(3) {
    animation: menu4 0.3s ease-in-out forwards;
    animation-delay: 0.9s;
}

.main li:hover .menu4 li:last-of-type {
    animation: menu4 0.3s ease-in-out forwards;
    animation-delay: 1.2s;
}

@keyframes menu4 {
    0% {
        opacity: 0;
        transform: translateX(50px) rotate(-90deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0);
    }
}


/*------------- menu5 animation -------------------*/

.main li:hover .menu5 li:first-of-type {
    animation: menu5 0.3s ease-in-out forwards;
    animation-delay: 0.3s;
}

.main li:hover .menu5 li:nth-of-type(2) {
    animation: menu5 0.3s ease-in-out forwards;
    animation-delay: 0.6s;
}

.main li:hover .menu5 li:nth-of-type(3) {
    animation: menu5 0.3s ease-in-out forwards;
    animation-delay: 0.9s;
}

.main li:hover .menu5 li:last-of-type {
    animation: menu5 0.3s ease-in-out forwards;
    animation-delay: 1.2s;
}

@keyframes menu5 {
    0% {
        opacity: 0;
        transform: rotateX(-90deg);
    }
    100% {
        opacity: 1;
        transform: rotateX(0);
    }
}


/*------------- menu6 animation -------------------*/

.main li:hover .menu6 li:first-of-type {
    animation: menu6 0.3s ease-in-out forwards;
    animation-delay: 0.2s;
}

.main li:hover .menu6 li:nth-of-type(2) {
    animation: menu6 0.3s ease-in-out forwards;
    animation-delay: 0.4s;
}

.main li:hover .menu6 li:nth-of-type(3) {
    animation: menu6 0.3s ease-in-out forwards;
    animation-delay: 0.6s;
}

.main li:hover .menu6 li:last-of-type {
    animation: menu6 0.3s ease-in-out forwards;
    animation-delay: 0.8s;
}

@keyframes menu6 {
    0% {
        opacity: 0;
        transform: scale(3);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}


/* my button style */

.white-mode {
    text-decoration: none;
    padding: 7px 10px;
    background-color: #122;
    border-radius: 3px;
    color: #fff;
    transition: 0.35s ease-in-out;
    position: absolute;
    left: 15px;
    bottom: 15px;
    font-family: sans-serif;
}

.white-mode:hover {
    background-color: #fff;
    color: #122;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/796991.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

51单片机:数码管和矩阵按键

目录 一:动态数码管模块 1:介绍 2:共阴极和共阳极 A:共阴极 B:共阳极 C:转化表 3:74HC138译码器 4:74HC138译码器控制动态数码管 5:数码管显示完整代码 二:矩阵按键模块 1:介绍 2:原理图 3:矩阵按键代码 一:动态数码管模块 1:介绍 LED数码管&#xff1a;数码管是一种…

【数字IC】芯片产业链

芯片产业链 FoundaryFablessEDADesign ServiceIP供应商IDM就业岗位 Foundary Fabless 无晶圆厂 IC design house EDA Design Service Veri Silicon &#xff1a; 芯原微 Alchip&#xff1a;世芯&#xff08;上海&#xff09; Brite&#xff1a;灿芯&#xff08;上海&…

Vue+ElementUI操作确认框及提示框的使用

在进行数据增删改查操作中为保证用户的使用体验&#xff0c;通常需要显示相关操作的确认信息以及操作结果的通知信息。文章以数据的下载和删除提示为例进行了简要实现&#xff0c;点击下载以及删除按钮&#xff0c;会出现对相关信息的提示&#xff0c;操作结果如下所示。 点击…

“数字化员工”,正在占领厂区

劳动力规模逐年降低、劳动生产率增速被平均工资增速超越——中国企业正在面临用工难题。为了应对这一困境&#xff0c;唯一的解决方案就是全面转向“第四种用工模式”——“数字化劳动力”&#xff0c;它可以全力激活人效潜能&#xff0c;并助力企业行稳致远。 智能中央立库中的…

放射组学增强的深度多任务学习用于头颈癌预后预测

文章目录 Radiomics-enhanced Deep Multi-task Learning for Outcome Prediction in Head and Neck Cancer摘要本文方法实验结果 Predicting Regions of Local Recurrence in Glioblastomas Using Voxel-Based Radiomic Features of Multiparametric Postoperative MRI摘要方法…

猿人学第二题—混淆 动态cookie检测

猿人学第二题—混淆 动态cookie检测 1、代码格式化检测2、检测global和navigator.vendorSub3、检测setInterval思考 4、console.log输出检测补环境 简单的document.cookie&#xff0c;location.reload等就不写了 1、代码格式化检测 这里应该是利用了字符串正则匹配性能低的特点…

管理类联考——写作——素材篇——论说文——可持续发展——食蚁兽

巴西热带雨林中的食蚁兽在捕食时&#xff0c;使用带粘液的长舌伸进蚁穴捕获白蚁&#xff0c;但不管捕获多少&#xff0c;每次捕食都不超过3分钟&#xff0c;然后去寻找下一个目标&#xff0c;从来不摧毁整个蚁穴。而那些没有被食蚁兽捕获的工蚁就会修复蚁穴&#xff0c;蚁后也会…

【C++进阶之路】继承篇

文章目录 前言一、概念二、性质1.赋值转换2.作用域——隐藏/重定义3.默认成员函数①构造函数②拷贝构造③析构函数④赋值重载 4.友元函数5.多继承①单继承—— "一脉单传"②多继承——"一父多子"③菱形继承—— "一子多父"④菱形虚拟继承 三、总…

【数据分享】1999—2021年地级市固定资产投资和对外经济贸易数据(Shp/Excel格式)

在之前的文章中&#xff0c;我们分享过基于2000-2022年《中国城市统计年鉴》整理的1999-2021年地级市的人口相关数据、各类用地面积数据、污染物排放和环境治理相关数据、房地产投资情况和商品房销售面积、社会消费品零售总额和年末金融机构存贷款余额、地方一般公共预算收支状…

第二十章 原理篇:CLIP

参考教程&#xff1a; 【PDF】Learning Transferable Visual Models From Natural Language Supervision https://github.com/openai/CLIP 文章目录 概述方法自然语言监督创建一个足够大的数据集选择高效的预训练方法代码解读 选择和缩放模型训练使用 代码解读model load rel…

软件测试:单点登录之—单点流程

用户认证中心采用票据传递的方式进行用户信息共享&#xff0c;保证登录会话在不同的站点进行创建。用户访问目标站点时通过当前登录的站点创建票据&#xff0c;传递票据到目标站点&#xff0c;目标站点接收到票据之后调用用户中心认证系统接口进行票据认证&#xff0c;认证成功…

【C语言15】单链表,(对于二级指针与一级指针应用的详细讲述)

文章目录 单链表1.单链表的介绍2.单链表的实现2.1.1单链表结点的创建与销毁2.1.2单链表尾插2.1.3单链表打印2.1.4尾删2.1.5头插2.1.6头删2.1.7查找2.1.8在pos位置之后插入数据2.1.9删除pos位置 单链表 1.单链表的介绍 链表是一种物理存储结构上非连续、非顺序的存储结构&#…

科学家用ChatGPT写完1篇论文仅用1小时!多所高校撤销禁令

自2022年11月发布以来&#xff0c;许多人都在使用ChatGPT来帮助他们完成工作&#xff0c;各行各业的人都在使用&#xff0c;从撰写营销材料&#xff0c;到起草电子邮件&#xff0c;再到生成报告。 ChatGPT作为一种人工智能工具&#xff0c;在科研中也显示非常大的应用潜力&…

汽车行业 Y 公司对接斯堪尼亚 SCANIA EDI 项目案例

斯堪尼亚是一家来自瑞典的重型车辆制造公司&#xff0c;成立于1891年&#xff0c;总部位于斯德哥尔摩&#xff0c;主要专注于生产卡车、客车和工业发动机&#xff0c;以及相应的服务与解决方案。斯堪尼亚的产品以其高品质、可靠性和先进技术而闻名。其卡车广泛应用于货运和运输…

大文件传输过程中的网络拥塞控制方法研究

随着网络技术的进步&#xff0c;我们在工作和生活中经常需要传输大文件。但是在实际的文件传输过程中&#xff0c;网络拥塞问题一直是困扰着我们和网络服务商的一个难题。接下来将从网络拥塞的原因、影响以及控制方法等方面详细介绍大文件传输过程中的网络拥塞控制方法。 一、网…

Gnomon室外照明学习

阴影 复制4个 15 开启主光 复制选择45度的那组灯光 关闭阴影 灯光颜色吸取地面 对比 组 X和Z平移归0 整体旋转 太阳调整 吸取图片上面的颜色&#xff0c;天空那组灯 复制一个

【Vscode | R | Win】R Markdown转html记录-Win

Rmd文件转html R语言环境Vscode扩展安装及配置配置radian R依赖包pandoc安装配置pandoc环境变量验证是否有效转rmd为html 注意本文代码块均为R语言代码&#xff0c;在R语言环境下执行即可 R语言环境 官网中去下载R语言安装包以及R-tool 可自行搜寻教程 无需下载Rstudio Vscod…

面试题 -- 客户端安全性和框架设计

文章目录 1. 客户端安全性处理方式2. sip是什么&#xff1f;3. 有些图片加载的比较慢怎么处理&#xff1f;你是怎么优化程序的性能的&#xff1f;4. 实现过一个框架或者库以供别人使用么&#xff1f;5. App需要加载超大量的数据&#xff0c;给服务器发送请求&#xff0c;但是服…

如何测试Linux内核

目录 概述 LTP 构建系统 C测试用例 参考资料 Autotest Kmemleak Kmemcheck Linaro LAVA 调试器 GDB KGDB 设备驱动测试 资料获取方法 概述 在本文中&#xff0c;我们将讨论用于测试Linux内核的各种框架和工具。首先&#xff0c;我们将介绍LTP( Linux Test Proje…

Ribbon 启用规则,SelectionCountRule规则在Classic界面下不生效,只有在UCI界面下才生效

Ribbon 启用规则&#xff0c;SelectionCountRule规则在Classic界面下不生效&#xff0c;只有在UCI界面下才生效。