css下拉菜单文字是竖着,怎么变成横着的?
<!doctypehtml><htmllang="en"><head><metacharset="UTF-8"><metaname="Generator"content=...
<!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>Document</title>
</head>
<style type="text/css">
.menu{
font-family: tahoma, geneva, "lucida sans unicode", "lucida grande",verdana, sans-serif;
position:relative;
}
.menu ul li{float:left;position:relative;display:block;margin:0px 50px 9px 5px;}
.menu ul li ul{float:left;position:absolute;display:none;
}
.menu ul li:hover ul{display:block;}
</style>
<body>
<div class="menu">
<ul>
<li><a href="#">
菜单一</a>
<ul><li>子菜单1</li>
<li>子菜单2</li>
<li>子菜单3</li>
</ul>
</li>
<li><a href="#">
菜单二</a>
<ul><li>子菜单1</li>
<li>子菜单2</li>
<li>子菜单3</li>
</ul>
</li>
</ul>
</div>
</body>
</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>Document</title>
</head>
<style type="text/css">
.menu{
font-family: tahoma, geneva, "lucida sans unicode", "lucida grande",verdana, sans-serif;
position:relative;
}
.menu ul li{float:left;position:relative;display:block;margin:0px 50px 9px 5px;}
.menu ul li ul{float:left;position:absolute;display:none;
}
.menu ul li:hover ul{display:block;}
</style>
<body>
<div class="menu">
<ul>
<li><a href="#">
菜单一</a>
<ul><li>子菜单1</li>
<li>子菜单2</li>
<li>子菜单3</li>
</ul>
</li>
<li><a href="#">
菜单二</a>
<ul><li>子菜单1</li>
<li>子菜单2</li>
<li>子菜单3</li>
</ul>
</li>
</ul>
</div>
</body>
</html> 展开
1个回答
推荐于2016-07-23
展开全部
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.menu {
font-family: tahoma, geneva, "lucida sans unicode", "lucida grande",verdana, sans-serif;
margin: auto;
width: 300px;
}
ul {
list-style: none;
text-align: center;
}
a {
text-decoration: none;
}
.menu>ul>li {
float: left;
width: 60px;
height: 30px;
line-height: 30px;
margin: 0 10px 0 10px;
}
.menu>ul li>ul {
display: none;
background-color: red;
}
a,li {
cursor: pointer;
}
.menu>ul li:hover {
background-color: #fd3;
}
.menu>ul li:hover>ul {
display: block;
}
</style>
</head>
<body>
<div class="menu">
<ul>
<li> <a href="#">
菜单一
</a>
<ul>
<li>子菜单1</li>
<li>子菜单2</li>
<li>子菜单3</li>
</ul>
</li>
<li> <a href="#">
菜单二
</a>
<ul>
<li>子菜单1</li>
<li>子菜单2</li>
<li>子菜单3</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
追问
我的代码为什么会出现竖着的情况??
追答
这些都是你的代码
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询