zoukankan      html  css  js  c++  java
  • css随笔1

    要用到css,首先就得引入,今天学会了三种css的引入方式:

    1.行内引用

    <body style="background-color:red;">
    
    <p style="color:#666;">这是行内引用css层叠样式后的P标签</p>

    PS:记得要养成良好习惯,写完一个属性 值后加分号,注意是英文状态下哦。

    2.业内引用

    <head>
            <style type="text/css">
                body{
                           background-color:red;
                        }
    </head>
    
    
    <head>
            <style type="text/css">    /*type="text/css" 对浏览器声明应用的是css*/
    h1
    { background:red; font-size:12px; }

    </head>

    ps:虽然<style></style>标签可以定位在任何地方,但是,我们要把它定位在<head></head>之中,因为这样可以以最快的速度加载。    

    3.外部引用

    在css里面:
    p{
        font-size:12px;
    }
    在html里面:
    <head>
      <link rel="stylesheet" type="text/css" href="css样式的路径“/>
    </head>
    
    
    在css里面:
    h1{
        font-size:12px;
        color:red;
    }
    在html里面:
    <head>
      <link rel="stylesheet" type="text/css" href="css样式的路径“/>
    </head>

    PS:三种引入方式的优先级:就近原则 -------行内引用>业内引用>页外引用 

    通配选择符  *

    *{
        color:red;
    }
    
    *{
       font-size:12px
    }

    元素选择符

    h1{
      color:red;
    }
    
    
    p{
       font-size:12px;
    }

    群组选择符

    h1,p{
             color:red;
    }
    
    
    h1,h3,h5,p{
                     font-size:12px;
                     color:red;
     }
  • 相关阅读:
    js如何求一组数中的极值
    五星评分效果 原生js
    省市区三级联动
    jq表头固定
    css垂直居中 两种方法
    node.js grunt文件压缩
    js 定时器
    动态规划---最长公共子序列
    AES,RSA对称加密和非对称加密
    正则表达式学习笔记
  • 原文地址:https://www.cnblogs.com/qq1193447294/p/5751431.html
Copyright © 2011-2022 走看看