day37 css

 day37 css
 
表现标准:CSS
    css: cascading style sheet : 层叠样式表
    作用: 修饰网页结构
    css的三种引入方式:
        1.行内样式
        2.内接样式
        3.外接样式
    三种方式的优先级:行内样式的优先级最高, 然后内接和外接, 这俩谁写在后面谁的优先级高
 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--外接样式-->
    <link rel="stylesheet" href="./index.css">
    <!--内接样式-->
    <style type="text/css">
        /*选择器*/
        span{
            color: green;
            font-size: 50px;
        }
    </style>
    <!--连接js文件-->
    <script type="text/javascript" src="./index.js"></script>
</head>
<body>
    <!--行内样式-->
    <p style="color: red; font-size: 30px">bajieaishuishui</p>                                                                                                                                                                   
    <span>八戒</span>
</body>
</html>
 
    css的基本选择器  
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="./reset.css">
    <style>
        /*1.标签选择器:选择的是所有的有'共性的*/
        p{
            color: red;
        }
        /*重置样式: 把前面的小圆点干掉*/
        ul{
            list-style-type: none;
        }
        /*2.类选择器: 用 .类名: 选择的也是有'共性的'*/
        .active{
            color: blueviolet;
        }
        .large{
            font-size: 40px;
        }
        /*3.id选择器: id是唯一的不能重复: 选中的是""特性: 用#号来表示*/
        #p1{
            color: yellow;
        }
        #p2{
            color: green;
        }
        /*4.通配符选择器: 用*号: 选中页面中所有标签. 在工作中不要用: 选中所有是有消耗的*/
        /*一开始布局页面如果写css, 一定要重置, 不用这个, 用别人写好的重置库, 写到reset.css文件里, 用link链接进来*/
        /**{*/
            /*padding: 0;*/
            /*margin: 0;*/
        /*}*/
        /*去掉a 超链接下面的下滑线(注:其他标签默认没有下划线不用去)*/
        a{
            text-decoration: none;
        }
        /*用span伪造一个超链接,加颜色, 加下划线, 加小手*/
        .baidu{
            color: blue;
            text-decoration: underline;
            cursor: pointer;    #(光标: 指针)
        }
    </style>
</head>
<body>
    <p id="p1">八戒爱谁谁</p>
    <p>八戒爱谁谁1</p>
    <p id="p2">八戒爱谁谁2</p>
    <p>八戒爱谁谁3</p>
    <p>八戒爱谁谁4</p>
    <ul>
        <!-- class 可以用多个名字, 用空格隔开 -->
        <li class="active large">
            bajie
        </li>
        <li>
            大唐
        </li>
    </ul>
    <ul>
        <li class="active">
            wukong
        </li>
    </ul>
    <a href="http://www.baidu.com/">百度一下</a>
    <span class="baidu">百度一下</span>
</body>
</html>      
 
    css的高级选择器
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        /*组合选择器: */
        ul,ol{
            list-style-type: none;
        }
        input{
            /*border none隐藏边框*/
            border: none;
            /*如果不设置宽高, 就自适应前面字体的宽高*/
            /*width: 100px;*/
            /*height: 30px;*/
            /*自定义边框, 高, 宽, 样式三要素*/
            border: 1px solid red;
        }
    </style>
</head>
<body>
    <ul>
        <li class="active">
            wukong
        </li>
    </ul>
    <span class="baidu">百度一下</span>
    <input type="text">
    <ol>
        <li>
            one
        </li>
        <li>
            two
        </li>
    </ol>
</body>
</html>
 
 
(外边距: margin, 内边距: padding, 边框: border)
https://www.w3school.com.cn/ w3c标准的各种协议
 
reset.css
/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
        margin: 0;
        padding: 0;
        border: 0;
        font-size: 100%;
        font: inherit;
        vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
        display: block;
}
body {
        line-height: 1;
}
ol, ul {
        list-style: none;
}
blockquote, q {
        quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
        content: '';
        content: none;
}
table {
        border-collapse: collapse;
        border-spacing: 0;
}
 
 
 
 
 
 
 
 

猜你喜欢

转载自www.cnblogs.com/aiaii/p/11914568.html