Blogger Information
Blog 7
fans 0
comment 0
visits 4711
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css基础知识--2019年4月25日10:58:08
MrLv的博客
Original
603 people have browsed it
  1. 写一个案例, 演示css中的选择器优先级(忽略js)



    实例

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    <style>
        h1 {
            background-color: yellowgreen;
        }
        .id{
            background-color: aquamarine;
        }
        #id{
            background-color: blueviolet;
        }
    </style>
    <h1 id="" class="" title="" style="">标签颜色选择器</h1>
    <h1 id="" class="id" title="" style="">class颜色选择器</h1>
    <h1 id="id" class="id" title="" style="">id颜色选择器</h1>
    <h1 id="id" class="id" title="" style="background-color: brown">style颜色选择器</h1>
    </body>
    </html>

    运行实例 »

    点击 "运行实例" 按钮查看在线实例

  2. 写一个盒模型的简单案例,体会padding/border的简写规则


    实例

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>盒模型</title>
    </head>
    <body>
    <style>
        .h1{
            width: 500px;
            height: 300px;
        }
        .h2{
            width: 500px;
            height: 300px;
        }
        .a1{
            width: 200px;
            height: 200px;
            background-color: blueviolet;
            padding-top: 20px;
            padding-right: 4px;
            padding-bottom: 10px;
            padding-left: 10px;
            margin-top: auto;
            margin-right: 5px;
            margin-bottom: 5px;
            margin-left: auto;
        }
        .a2{
            width: 200px;
            height: 200px;
            background-color: green;
            padding:20px 4px 10px 10px;
            margin: auto 5px;
        }
        .b1{
            width: 200px;
            height: 200px;
            border-top-width: 10px;
            border-top-style: solid;
            border-top-color: pink;
            border-right-width: 10px;
            border-right-style: solid;
            border-right-color: pink;
            border-bottom-width: 10px;
            border-bottom-style: solid;
            border-bottom-color: pink;
            border-left-width: 10px;
            border-left-style: solid;
            border-left-color: pink;
            margin-top: auto;
            margin-right: 5px;
            margin-bottom: 5px;
            margin-left: auto;
        }
        .b2{
            width: 200px;
            height: 200px;
            border:10px solid pink;
            margin: auto 5px;
        }
    </style>
    <div class="h1">
    <div class="a1" style="float:left">
        <img src="http://www.php.cn/static/images/user_avatar.jpg">
        <p>内边距8行代码</p>
    </div>
    <div class="a2" style="float:left">
        <img src="http://www.php.cn/static/images/user_avatar.jpg">
        <p>内边距2行代码</p>
    </div>
    </div>
    <div class="h2" >
    <div class="b1" style="float:left">
        <img src="http://www.php.cn/static/images/user_avatar.jpg">
        <p>边框16行代码</p>
    </div>
    <div class="b2" style="float:left">
        <img src="http://www.php.cn/static/images/user_avatar.jpg">
        <p>边框2行代码</p>
    </div>
    </div>
    </body>
    </html>

    运行实例 »

    点击 "运行实例" 按钮查看在线实例

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments