美文网首页
表格 、背景

表格 、背景

作者: Khada | 来源:发表于2018-06-27 11:44 被阅读0次

    1.按钮练习

     <!DOCTYPE html>
    <html>
    <head>
    <title>按钮练习</title>
    <meta charset="utf-8" />
    <style type="text/css">
        .cc{
            display: block;
            width: 161px;
            height: 44px;
            background-image: url(amazon-sprite_.png)
            /*background-repeat: no-repeat;*/
        }
        .cc:active{
            display: block;
            width: 43px;
            height: 31px;
            background-image: url(amazon-sprite_.png);
            /*background-repeat: no-repeat;*/
            background-position: -58px -338px;
        }
        /*.cc:active{
            background-image: url(timg3.jpg);
            background-position: -400px 0px;
        }*/
        
    </style>
    </head>
    <body>
    <a href="#" class="cc"></a>
    </body>
    </html>
    

    2.背景

    <!DOCTYPE html>
     <html>
    <head>
    <title>背景</title>
    <meta charset="utf-8" />
    <style type="text/css">
        .box1{
            width: 1920px;
            height: 1200px;
            margin: 0 auto;
            background-color: #bfa;
            /*background-image: url(timg3.jpg)*/
        }
    </style>
    </head>
    <body>
    <div class="box1"></div>
    </body>
    </html>
    

    3.背景属性

    <!DOCTYPE html>
    <html>
    <head>
    <title>简写属性背景</title>
    <meta charset="utf-8" />
    <style type="text/css">
        body{
            height: 5000px;
            /*background-color: #bfa;
            background-repeat: no-repeat;
            background-image: url(timg3.jpg);
            background-position: center;
            background-attachment: fixed;*/
            background-color: #bfa;
            background: url(timg3.jpg) center center
                no-repeat fixed;
            
        }
    </style>
    </head>
    <body>
    
    </body>
    </htmml>
    

    4.表格

     <!DOCTYPE html>
    <html>
    <head>
    <title>表格</title>
    <meta charset="utf-8" />
    <style type="text/css">
        
    </style>
    </head>
    <body>
    <table border="1" width="50%" align="center">
        <tr>
            <td rowspan="2">A1</td>
            <td>A2</td>
            <td>A3</td>
        </tr>
        <tr>
            
            <td colspan="2">A2</td>
            
        </tr>
    
    </table>
    </body>
    </htmml>
    

    5.给表格添加样式

    <!DOCTYPE html>
    <html>
    <head>
    <title>给表格添加样式</title>
    <meta charset="utf-8" />
        <style type="text/css">
            table{
                width: 694px;
                height: 50px;
                margin: 0 auto;
                border-collapse: collapse;
        }
            td{
                border: 1px solid gold; 
                text-align-last: center; 
        }
            td:hover{
                background-color: orange;
        }
            a{
                font-size: 16px;
                font-family: "微软雅黑";
                color: pink;
                text-decoration: none;
        }
            a:hover{
                color: red;
        }
        </style>
    </head>
    <body>
    <table>
        <tr>
            <td><a href="#">首页</a></td>         
            <td><a href="#">公司简介</a></td>
            <td><a href="#">解决方案</a></td>
            <td><a href="#">公司新闻</a></td>
            <td><a href="#">行业动态</a></td>
            <td><a href="#">招贤纳才</a></td>
            <td><a href="#">联系我们</a></td>
        </tr>
    
    </table>
    </body>
    </html>
    

    6.导航标

     <!DOCTYPE html>
    <html>
    <head>
    <title>导航标</title>
    <meta charset="utf-8" />
    <style type="text/css">
        table{
            width: 960px;
            height: 42px;
            margin: 0 auto;
            border: 1px solid gold;
        }
        a{
            font-family: "微软雅黑";
            font-size: 12px;
            padding: 5px 10px;
            border: 1px solid gold;
            background-color: gold;
            text-decoration: none;
            margin-right: 1px;
        }
        td{
            overflow: hidden;
            text-align: 30px;
            padding-top: 5px;
            text-align-last: center;
        }
        a:hover{
            background-color: red;
        }
        tr{
            padding-left: 300px;
            overflow: hidden;
        }
    </style>
    </head>
    <body>
    <table>
        <tr>
            <td><a href="#">上一页</a></td>
            <td><a href="#">1</a></td>
            <td><a href="#">2</a></td>
            <td>...</td>
            <td><a href="#">3</a></td>
            <td><a href="#">4</a></td>
            <td><a href="#">下一页</a></td>
        </tr>
    </table>
    </body>
    </htmml>
    

    7.固定单位

     <!DOCTYPE html>
    <html>
    <head>
    <title>固定定位</title>
    <meta charset="utf-8" />
    <style type="text/css">
        .box1{
            width: 200px;
            height: 200px;
            background-color: red;
            position: relative;
            opacity: 0.5;
            filter: alpha(opacity=50)
        }
        .box2{
            width: 200px;
            height: 200px;
            background-color: blue;
            position: absolute;
            top: 100px;
            left: 100px;
            opacity: 0.5
        }
        .box3{
            width: 200px;
            height: 200px;
            background-color: green;
            position: absolute;
            left: 200px;
            top: 200px; 
            opacity: 0.5;
        }
        /*.box4{
            width: 200px;
            height: 200px;
            background-color: yellow;
            position: relative;
        }
        .box5{
            width: 100px;
            height: 100px;
            background-color: orange;
            position: absolute;
        }*/
    </style>
    </head>
    <body>
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
    <!-- <div class="box4">
        <div class="box5"></div>
    </div> -->
    </body>
    </html>
    

    8.给表格添加样式

     <!DOCTYPE html>
    <html>
    <head>
    <title>给表格添加样式</title>
    <meta charset="utf-8" />
    <style type="text/css">
        table{
            width: 300px;
            margin: 0px auto;
            /*border: 1px solid black;
            border-bottom: 10px;*/
            border-collapse: collapse;
        }
        th,td{
            border: 1px solid black;
        }
        /*tr:nth-child(odd){
            background-color: #bfa
        }*/
        tr:nth-child(even){
            background-color: #bfa
        }
        tr:hover{
            background-color: blue;
        }
    </style>
    </head>
    <body>
    <table>
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>住址</th>
        </tr>
        <tr>
            <td>1</td>
            <td>孙悟空</td>
            <td>男</td>
            <td>花果山</td>
        </tr>
        <tr>
            <td>2</td>
            <td>猪八戒</td>
            <td>男</td>
            <td>高老庄</td>
        </tr>
        <tr>
            <td>2</td>
            <td>猪八戒</td>
            <td>男</td>
            <td>高老庄</td>
        </tr>
        <tr>
            <td>2</td>
            <td>猪八戒</td>
            <td>男</td>
            <td>高老庄</td>
        </tr>
    </table>
    </body>
    </html>
    

    9.固定定位

    <!DOCTYPE html>
    <html>
    <head>
    <title>固定定位</title>
    <meta charset="utf-8" />
    <style type="text/css">
        .box1{
            width: 200px;
            height: 200px;
            background-color: red;
        }
        .box2{
            width: 200px;
            height: 200px;
            background-color: blue;
        }
        .box3{
            width: 200px;
            height: 200px;
            background-color: green;
        }
        .box4{
            width: 100px;
            height: 100px;
            background-color: gold;
            position: fixed;
            left: 10px;
            top: 10px;
        }
    </style>
    </head>
    <body>
    <div style="">
    <div class="box1">
        <div class="box4"></div>
    </div>
    <div class="box2"></div>
    <div class="box3"></div>
    </body>
    </html>

    相关文章

      网友评论

          本文标题:表格 、背景

          本文链接:https://www.haomeiwen.com/subject/kldbyftx.html