zoukankan      html  css  js  c++  java
  • ●CSS样式表

    CSS(Cascading Style Sheets,层叠样式表),作用:美化HTML网页。样式表优先级高

    1、内联样式表


    2、内嵌样式表

      必须写在head里
      <style type= "text/css">
      k    //格式对k起作用
      {
        样式;
      }
      </style>
    3、外部样式表(重用度高)

      新建一个CSS文件,用来放样式表。如果要在HTML文件中调用样式表,需要在HTML文件中点右键→CSS样式→附加样式表。

      

    样式表注释/* …… */

    选择器
    1、标签选择器。标签名做选择器


    2、class选择器。都是“.”开头

      <head>
      <style type="text/css">
      .main     /*定义样式*/
      {
        height:42px;
        100%;
        text-align:center;
      }
      </style>
      </head>

      <body>
      <div class="main">       <!--调用样式表-->
      </div>

      </body>


    3、ID选择器。以“#”开头
      <div id="样式名">

      <head>
      <style type="text/css">
      #main     /*定义样式*/
      {
        height:42px;
        100%;
        text-align:center;
      }
      </style>
      </head>

      <body>
      <div id="main">       <!--调用样式表-->
      </div>

      </body>


    复合选择器。
    1、用“,”隔开,表示并列

      <style type="text/css">
      p,span    /*标签p、span两者同样的样式*/
      {
        样式;
      }
      </style>


    1、用空格隔开,表示后代

      <style type="text/css">
      .main p    /*找到使用样式“main”的标签,在该标签里的P标签使用该样式*/

      {
        样式;
      }
      </style>


    3、筛选“.”

  • 相关阅读:
    python中读取文件数据时要注意文件路径
    sklearn.model_selection 的 train_test_split作用
    matplotlib中subplot的各参数的作用
    用梯度下降算法求最值
    AfxMessageBox与MessageBox用法与区别
    MFC、API、C++三者的区别
    2、CString与string借助char *互转
    1、创建MFC应用程序——单个文档
    1、Mat类的属性、方法
    CMake编译OpenCV
  • 原文地址:https://www.cnblogs.com/phantom-k/p/3976039.html
Copyright © 2011-2022 走看看