zoukankan      html  css  js  c++  java
  • 2.圆角菜单的两种方法和菜单的缩放

     方法一:设置成背景图片 style{background:url(../image/2.jpg);}

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>垂直菜单</title>
        <style type="text/css">
            *{margin: 0;padding: 0;}
            .class1 {border-bottom: 5px solid #f60;height: 50px;padding-left: 30px;list-style: none;}
            .class1 li a{display: block;float: left;width: 120px;height: 30px;margin-top:20px;line-height: 30px;text-align: center;text-decoration: none;background: url(../image/2.jpg);}
            .class1 li .shouYe,.class1 li a:hover{color: white;background: url(../image/1.jpg);background-position:  0 -30px}
    
        </style>
    </head>
    <body>
        <ul class="class1">
            <li><a href="" class="shouYe">首   页</a></li>
            <li><a href="">新闻快讯</a></li>
            <li><a href="">产品展示</a></li>
            <li><a href="">联系我们</a></li>
        </ul>    
    </body>
    </html>

    方法二:直接设置成圆角样式 style{border-top-left-radius:20px;border-top-right-radius:20px;}

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>垂直菜单</title>
        <style type="text/css">
            *{margin: 0;padding: 0;}
            .class2{border-bottom: 5px solid #f60;height: 50px;padding-left: 30px;list-style: none;}
            .class2 li a{display: block;float: left;width: 120px;height: 30px;margin-top: 20px;line-height: 30px;text-align: center;text-decoration: none;background-color: #ccc;border-top-left-radius: 20px;border-top-right-radius: 20px;}
            .class2 li .shouYe,.class2 li a:hover{color: white;background-color: #f60}
        </style>
    </head>
    <body>
        <ul class="class2">
            <li><a href="" class="shouYe">首   页</a></li>
            <li><a href="">新闻快讯</a></li>
            <li><a href="">产品展示</a></li>
            <li><a href="">联系我们</a></li>
        </ul>
        
    </body>
    </html>

     

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>垂直菜单</title>
        <style type="text/css">
            *{margin: 0;padding: 0;}
            /*可以伸缩的菜单*/
            .class3{
                border-bottom: 5px solid #f60;
                list-style: none;
                height: 50px;
                padding-left: 30px;
            }
            .class3 li a{
                text-decoration: none;
                width: 120px;
                line-height: 30px;
                margin-top: 20px;
                background: #ccc;
                float: left;
                text-align: center;
            }
            .class3 .shouYe{
                color: white;
                background: #f60;
            }
            .class3 .shouYe:hover,.class3 a:hover{
                color: white;
                background: #f60;
                height: 40px;
                margin-top: 10px; /*往上移10px*/
                line-height: 40px; /*文字上下居中显示*/
            }
        </style>
    </head>
    <body>
        <ul class="class3">
            <li><a href="" class="shouYe">首   页</a></li>
            <li><a href="">新闻快讯</a></li>
            <li><a href="">产品展示</a></li>
            <li><a href="">联系我们</a></li>
        </ul>
        
    </body>
    </html>
  • 相关阅读:
    Openjudge 1.3 算数表达式与顺序执行
    Openjudge 1.2 变量定义、赋值并转换
    Openjudge 1.4 逻辑表达式与条件分支
    Openjudge 1.5 循环控制
    Openjudge 1.6 一位数组
    Openjudge 1.8 多维数组
    poj-3134 ida*||记录路径bfs
    wust-1588 日期模拟题
    wust 1599弗洛伊德
    hdu5667 费马小定理加矩阵快速幂
  • 原文地址:https://www.cnblogs.com/chenJieLing/p/11659832.html
Copyright © 2011-2022 走看看