Home > Article > Web Front-end > How to switch between Chinese and English in the navigation bar in js
This time I will show you how to switch between Chinese and English in the navigation bar with js. What are the precautions for switching between Chinese and English in the navigation bar with js. The following is a practical case, let's take a look.
The height of ul is half of li, ul{overflow:hidden}
li:hover{margin-top:-40px;}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/> <title>中英切换导航条</title> <styletype="text/css"> *{padding:0; margin:0;} li{ list-style:none; } a{ text-decoration:none;} .nav{ width:100%; height:40px; background:#222; margin-top:100px; overflow:hidden;} .list{ width:1000px; height:40px; margin:0 auto;} .list li{ float:left;} .list li a{ display:block; transition:0.3s;} .list b,.list i{ display:block; padding:0 30px; color:#aaa; line-height:40px; text-align:center;} .list b{ font-weight:100} .list i{ font-style:normal; background:#333; color:#fff;} .list a:hover{ margin-top:-40px;} </style> </head> <body> <pclass="nav"> <ulclass="list"> <li> <ahref="#"> <b>Index</b> <i>首页</i> </a> </li> <li> <ahref="#"> <b>course</b> <i>职业课程</i> </a> </li> <li> <ahref="#"> <b>study</b> <i>就业学习</i> </a> </li> <li> <ahref="#"> <b>BBS</b> <i>社区</i> </a> </li> <li> <ahref="#"> <b>JiKe+</b> <i>发现+</i> </a> </li> </ul> </p> </body> </html>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
JS implementation of chessboard coverage
Detailed explanation of the use of js parasitic combined inheritance
The above is the detailed content of How to switch between Chinese and English in the navigation bar in js. For more information, please follow other related articles on the PHP Chinese website!