CSS sets the list style and creates the navigation menu implementation code

CSS sets the list style and creates the navigation menu implementation code

1. Set the list symbol

list-style-type: attribute; //Set list style

list-style-type: none; //clear style

There are many properties you can try yourself: circle, disc, decimal. . . .

2. Set list picture symbols

Set image symbol for ul,ol

ul,ol{
     list-style-image: url("li.png")
 }

Code:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Set list symbols</title>
<style type="text/css">
ul,ol{
 list-style-image: url("li.png")
}
</style>
</head>
<body>
<ul>
 <li>Home</li>
 <li>My Blog</li>
 <li style="list-style-image: url('image.png')">My photo album</li>
 <li>Leave a message</li>
 <li>About me</li>
</ul>
<ol>
 <li>Home</li>
 <li>My Blog</li>
 <li>My photo album</li>
 <li>Leave a message</li>
 <li>About me</li>
</ol>
</body>
</html>

Display effect:

3. Create a simple navigation menu

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Creating a simple navigation menu</title>
<style type="text/css">
#navigation{
/* width: 120px; */
 
 font-family: Arial;
 font-size: 14px;
 text-align: center;
}
#navigation ul{
 list-style-type: none;
 margin:0px;
 padding:0px;
}
#navigation li{
 border-bottom:1px solid #9F9FED; /* Add underline */ 
 float: left; /* horizontal arrangement */
} 
#navigation li a{
 display: block;
 height:1em;
 padding: 5px 5px 5px 0.5em;
 text-decoration: none;
}
#navigation li a:link,#navigation li a:visited{
 background-color: #1136c1;
 color: #FFF;
}
#navigation li a:hover{ /* When the mouse passes by*/
 background-color: #002099; /* Change background */
 color: #ff0; /* Change text color */
}
</style>
</head>
<body>
<div id="navigation">
 <ul>
  <li><a href="#">Home</a></li>
  <li><a href="#">My Blog</a></li>
  <li><a href="#">My Photo Album</a></li>
  <li><a href="#">Leave a message</a></li>
  <li><a href="#">About Me</a></li>
 </ul>
</div>
</body>
</html> 

Summarize

The above is the CSS list style setting and navigation menu creation implementation code introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  W3C Tutorial (4): W3C XHTML Activities

>>:  A detailed discussion of components in Vue

Recommend

Vue basics MVVM, template syntax and data binding

Table of contents 1. Vue Overview Vue official we...

How to transfer files between Windows and Linux

File transfer between Windows and Linux (1) Use W...

Vue3 (Part 2) Integrating Ant Design Vue

Table of contents 1. Integrate Ant Design Vue 2. ...

Ideas and codes for realizing magnifying glass effect in js

This article example shares the specific code of ...

How to effectively compress images using JS

Table of contents Preface Conversion relationship...

MySQL column to row conversion tips (share)

Preface: Because many business tables use design ...

How to uninstall MySQL 5.7 on CentOS7

Check what is installed in mysql rpm -qa | grep -...

Steps for Vue to use Ref to get components across levels

Vue uses Ref to get component instances across le...

How to install MySQL using yum on Centos7 and achieve remote connection

Centos7 uses yum to install MySQL and how to achi...

Detailed Example of MySQL curdate() Function

MySQL CURDATE Function Introduction If used in a ...

How to fix some content in a fixed position when scrolling HTML page

This article mainly introduces how some content i...

Detailed explanation of redo log and undo log in MySQL

The most important logs in the MySQL log system a...

Problems with using wangeditor rich text editing in Vue

wangEditor is a web rich text editor developed ba...