qq_32460785 2015-11-03 05:29 采纳率: 100%
浏览 1475
已采纳

新手问一下问什么二级导航没有背景,且没对齐

 <<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head>
    <title>530</title>
<link rel="stylesheet" type="text/css" href="html.css">
</head>
<body>
<div id="school"></div>
<div class="nav">
    <ul>
        <li><a href="">我的大学</a></li>
        <ul>
            <li><a href="">学校概况</a></li>
            <li><a href="">校园风光</a></li>
            <li><a href="">BT DOWN</a></li>
        </ul>
    </ul>

</div>

</body>
</html>


*
{
    font-family: 楷体;
}
body
{
    font-color:rgb(35,35,35);
}
ul
{
    list-style:none;
}    
a
{
    text-decoration: none;
}
#school
{   width:669px; 
    height:104px;
    background-image:url("../个人HTML/校徽.png");
    background-repeat: no-repeat;
    margin:auto;
}
.nav
{
    width: 100%;
    height:40px;
    background-color:rgb(224,223,228); 
}
.nav ul
{
    width: 100px;
    margin: auto ;
    text-decoration: none;
}
.nav ul li
{
    margin-left: 10px;
    float: left;
    text-decoration: none;
}
.nav ul li a
{
    width: 100px;
    height:30px;
    padding-top: 10px;
    color: white;
    margin:0px 10px;
    font-size: 15px;
    display: block;
    text-align: center;
    text-decoration: none;
}
.nav ul li a:hover 
{
    background-color: rgb(104,140,140);
}
/*1*/

.nav ul li ul
{
    display: none;
}
.nav ul li:hover ul
{
    display: none;
    width: 100px;
    background-color: rgb(224,223,228);
    position: relative;
}
.nav ul li:hover ul li 
{
    display: none;
    width: 100px;
    height: 20px;
    font-size:12px;
    text-align: center;
    background-color: rgb(224,223,228);
}
.nav ul li:hover ul li a:hover
{
    border-color: rgb(104,140,140);
}
  • 写回答

1条回答 默认 最新

  • Go 旅城通票 2015-11-03 06:01
    关注

    结构都错了吧,ul怎么嵌入ul中了。。

    
    .nav ul li ul
    {
        displaxy: none;
        margin-left:10px;
        padding:0;
        width: 100px;
        background-color: rgb(224,223,228);
        position: relative;
    }
    .nav ul li:hover ul{display:block}
    .nav ul li ul li 
    {
        float:none;
        font-size:12px;
        width:auto;
        text-align: center;
        margin:0;
        background-color: rgb(224,223,228);
    }
    .nav ul li:hover ul li a:hover
    {
        border-color: rgb(104,140,140);width:auto;display:block;margin:0px;
    }
    
             <ul>
                <li><a href="">我的大学</a>
                    <ul>
                        <li><a href="">学校概况</a></li>
                        <li><a href="">校园风光</a></li>
                        <li><a href="">BT DOWN</a></li>
                    </ul></li>
            </ul>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误