美文网首页IT技术
day003_css基础

day003_css基础

作者: kusasakey | 来源:发表于2022-03-11 20:05 被阅读0次
  1. css 标签选择器 id选择器 类选择器(开发使用)

  2. css 链接方式 1、内嵌式(head标签内未分离,加载速度快) 2、外链式(分离) 3、行内式

  3. css后代选择器 并列选择器

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title> 复合选择器  css后代选择器 并列选择器</title>
        <style type="text/css">
            div span{color:pink;}
            div p,div h1{color:blue;}
            
            div.div1{font-size:100px;}
            p.p{color:green;}
        </style>
    </head>
    <body>      
        <h1>title1</h1>
        <div>
            <p>文章主题</p>
            <h1>title1</h1>
            
            <div >
                <span> span</span>
            </div>
        </div>
        <div class="div1">指定标签式</div>
        <p class="p">p.p</p>
    </body>
</html>
图片.png
  1. css选择器权重 1、内嵌和外嵌的CSS先写的会被后写的覆盖 2 、id>class>标签
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>复合选择器权重对比</title>
        <style type="text/css">
            span{color:red;}
            div span{color:blue!important;}
            p span{color:yellow;}
            .page span{color:red;}
            /*span_id{color:black;}*/
        </style>
    </head>
    <body>
        <div> 
            <p class="page">
                <span class="sp" id="span_id">hahahaa</span>
            </p>
        </div>
        <div class="p1"> 
            <p> 标签1 类10 id 100</p>
        </div>
        <div class="d"></div>
    </body>
</html>
权重计算.png
  1. google 案例
    google.html
 <!DOCTYPE html>
<html>
    <head >
        <meta charset="utf-8">
        <title>google</title>
        <style type="text/css">
            /*内嵌式css*/
        </style>
        <link rel="stylesheet" type="text/css" href="google.css"/>/*外嵌式css*/
    </head>
    <body>
        <span class="login blue">G</span>
        <span class="login_juhong">o</span>
        <span class="login_orange">o</span>
        <span class="login blue">g</span>
        <span class="login_green">l</span>
        <span class="login_red">e</span>
    </body>
</html>

google.css

span{font-size:100px;}
.blue{color:blue;}
.login_juhong{color:#cc3300;}
.login_orange{color:orange;}
.login_red{color:red;}
.login_green{color:green;}
google.png

6.css文字常见属性

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>css常见属性</title>
        <style type="text/css" >
            h1{font-weight:normal;}
            p{font-weight:bold;}
            h2{font-style:normal;}
            em{font-style:italic;}
            .a1{text-decoration:none;}
            .a2{text-decoration:line-through;}
            .a3{text-decoration:underline;}
            .a4{text-decoration:overline;}
            /*英文单词 word-break:break-al;*/
            h3{
                width:200px;
                height:200px;
                background:pink;
                text-decoration:overline;
                word-break:break-all;
            }
            /*伪类 鼠标移动事件实现:*/
            a:hover{color:green;}
            /*行高属性 line-height*/
            div p {
                width:200px;
                height:200px;
                background:pink;
                line-height:50px;
                word-break:break-all;
            }
        </style>
    </head>
    <body>  
        <h1> font-weight:normal;</h1>
        <p>font-weight:bold;</p>
        <em>font-syle:normal;</em>
        <h2>font-style:italic</h2>
        <a href="###">a default</a><br/>
        <a href="###" class="a1">a none </a><br/>
        <br/>
        <a href="###" class="a4">a overline</a><br/>
        <a href="###" class="a2">a line-through</a><br/>
        <a href="###" class="a3">a underline</a><br/>
        <h3>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</h3>
        <div>
            <p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
        </div>
        
        
    </body>
</html>
效果.png

7、盒子模型

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>盒子模型</title>
        <style >
            .div1{
                width:200px;
                height:200px;
                background:pink;
                border:10px solid green;
                /*solid 实线  dashed 虚线*/
            }
            .div2{
                width:200px;
                height:200px;
                background:pink;
                border-bottom:1px solid blue;
                border-top:5px dashed yellow;
            }
            .div3{
                width:200px;
                height:200px;
                background:pink;
                border-bottom:1px solid blue;
                border-top:5px dashed yellow;
            }
            
        </style>
    </head>
    <body>  
    
        <div class="div1">aaaa</div><br/>
        <div class="div2">aaaa</div><br/>
        <div class="div3">aaaa</div><br/>
        
    </body>
</html>
div3.png

框高+边框+内边距(内容+框的距离)+外边距(盒子和盒子之间对的距离)=盒子模型

8.html5 新标签 ie不支持,支持手机网页书写,提高搜索引擎对网站的优化。

相关文章

  • day003_css基础

    css 标签选择器 id选择器 类选择器(开发使用) css 链接方式 1、内嵌式(head标签内...

  • 机械设备安装技术

    设备基础种类及应用 垫层基础允许产生沉降:大型储罐 浅基础扩展基础联合基础:轧机独立基础 深基础桩基础:适用于需要...

  • 基础,基础,基础

    如果有人现在问我,JAVA该怎么学,我会告诉他不要急于求成,少看视频,多练,多思考。但说到这里有人可能会反...

  • 【Android】知识点汇总,坚持原创ing

    Android基础 Java基础 Java基础——Java内存模型和垃圾回收机制 语法基础 语法基础——C语法基础...

  • Java 基础

    Java 基础01Java开发入门 Java 基础02Java编程基础 Java 基础03面向对象 Java 基础...

  • 零基础学画画从入门到放弃

    零基础应该怎么学画画?零基础那就从基础开始学啊!基础是什么?造型基础和色彩基础。 造型基础就是用点线面组成起码能让...

  • 面试题汇总

    1.Java基础面试问题 Java基础之基础问题 Java基础之面向对象 Java基础之数据结构 Java基础之I...

  • 基础基础还是基础

    这次去面试,还是被基础给打趴下了。 对于PHP7的新特性没有了解。 对于TP的新特性没有了解。 再一个就是独立完成...

  • 零基础学UI设计需要美术基础吗?

    零基础学UI设计需要美术基础吗?零基础学UI设计需要美术基础吗?零基础学UI设计需要美术基础吗?零基础学UI设计需...

  • 基础基础!

    人生中第一个自主设计的实验方案终于得到认可^O^在设计方案过程中认识到基础知识以及细心的重要性,还有半个学期可以努...

网友评论

    本文标题:day003_css基础

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