This article will share with you how to create a cool navigation bar based on html and CSS3. The effect is very beautiful. Friends who need it can refer to it
Main highlights:
1 ul horizontal display
2 li remove dots
3 li center the font horizontally and vertically
4 li control border style
5 Use html css3 gradient painting to make background images
6 Change color transparency
7 p Make border shadow
Look at the renderings first:
##
<!doctype html> html lang="en"> <head> <meta charset="UTF-8"> <!----编码-----> <meta name="Generator" content="EditPlus®"> <meta name="Author" content="黄涛"> <meta name="Keywords" content="关键字,搜索引擎"> <meta name="Description" content="描述语言"> <title>案例</title> <style type="text/css"> *{ margin:0;padding:0; } body{background:url("images/bg_title.jpg") repeat-x,url("images/bg.jpg");} #Logo{ width:895px;height:45px; /*margin:上下 左右*/ margin:50px auto; border-radius:10px; /*html + css3 渐变画图 */ background-image:-webkit-linear-gradient(rgba(41,41,41,0.75) 0% ,rgba(54,54,54,0.72) 50%,rgba(24,23,23,0.94) 51%); box-shadow:1px 1px 33px #fff;/*设计阴影的*/ } #Logo ul li { width:127px; height:45px; list-style:none;/*去掉圆点*/ float:left;/*水平显示*/ color:white;/* #fff */ font-size:18px; font-family:"微软雅黑"; text-align:center; line-height:45px;/* 行高跟 高度一致时,竖直居中*/ border-right:1px solid #000;/*右边框*/ } #Logo ul li a { color:white;/* #fff */ font-size:18px; font-family:"微软雅黑"; text-decoration:none; } #Logo ul li:hover { background:rgba(10,5,5,0.45); } #Logo ul li.first:hover { border-radius:10px 0px 0px 10px;/*左上 左下 圆弧显示 */ } #Logo ul li.last:hover { border-radius:0px 10px 10px 0px;/*右上 右下 圆弧显示 */ } #Logo ul li ul li { border:none; border-top:1px solid #989898; background:rgba(10,5,5,0.45);/*颜色透明度 */ border-radius:10px; } #Logo ul li ul { display:none;/*不显示*/ } #Logo ul li ul li:hover { background:rgba(10,5,5,0.8);/*颜色透明度 */ border-radius:10px; } #Logo ul li:hover ul { display:block; -webkit-animation:roll 1s ease;/*roll 旋转名称,1s旋转效果 */ } @-webkit-keyframes roll /*roll旋转名称与上面一致*/ { 0% {-webkit-transform:rotate(0deg);} 100% {-webkit-transform:rotate(360deg);} } </style> </head> <body> <p id="Logo"> <ul> <li class="first"> <a href="#">网址<a> <ul> <li> <a href="http://www.baidu.com">百度</a> </li> <li> <a href="http://www.sina.com">新浪</a> </li> </ul> </li> <li> <a href="#">新闻<a> </li> <li> <a href="#">视频<a> </li> <li> <a href="#">音乐<a> </li> <li> <a href="#">地图<a> </li> <li> <a href="#">问问<a> </li> <li class="last" style="border:none;"> <a href="#">关于<a> </li> </ul> </p> </body> /html>The code is super simple, I hope it will be helpful for everyone to learn to make html and css3 to make a cool navigation bar .
How to use CSS3 to implement waterfall flow layout
How to use CSS3 with IE filters to achieve gradients and The effect of projection
About the simple implementation of css transition and 3D effect
##
The above is the detailed content of Implement navigation bar using html and CSS3. For more information, please follow other related articles on the PHP Chinese website!

What it looks like to troubleshoot one of those impossible issues that turns out to be something totally else you never thought of.

@keyframesandCSSTransitionsdifferincomplexity:@keyframesallowsfordetailedanimationsequences,whileCSSTransitionshandlesimplestatechanges.UseCSSTransitionsforhovereffectslikebuttoncolorchanges,and@keyframesforintricateanimationslikerotatingspinners.

I know, I know: there are a ton of content management system options available, and while I've tested several, none have really been the one, y'know? Weird pricing models, difficult customization, some even end up becoming a whole &

Linking CSS files to HTML can be achieved by using elements in part of HTML. 1) Use tags to link local CSS files. 2) Multiple CSS files can be implemented by adding multiple tags. 3) External CSS files use absolute URL links, such as. 4) Ensure the correct use of file paths and CSS file loading order, and optimize performance can use CSS preprocessor to merge files.

Choosing Flexbox or Grid depends on the layout requirements: 1) Flexbox is suitable for one-dimensional layouts, such as navigation bar; 2) Grid is suitable for two-dimensional layouts, such as magazine layouts. The two can be used in the project to improve the layout effect.

The best way to include CSS files is to use tags to introduce external CSS files in the HTML part. 1. Use tags to introduce external CSS files, such as. 2. For small adjustments, inline CSS can be used, but should be used with caution. 3. Large projects can use CSS preprocessors such as Sass or Less to import other CSS files through @import. 4. For performance, CSS files should be merged and CDN should be used, and compressed using tools such as CSSNano.

Yes,youshouldlearnbothFlexboxandGrid.1)Flexboxisidealforone-dimensional,flexiblelayoutslikenavigationmenus.2)Gridexcelsintwo-dimensional,complexdesignssuchasmagazinelayouts.3)Combiningbothenhanceslayoutflexibilityandresponsiveness,allowingforstructur

What does it look like to refactor your own code? John Rhea picks apart an old CSS animation he wrote and walks through the thought process of optimizing it.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
