css

发布时间 2023-07-18 16:58:47作者: 别管鱼油我了

css

html:超文本标记语言

css:层叠样式表(就是给html增加样式的,使其变得好看)

先学习选择器,选择器的作用是如何找到标签,找到标签后,给标签增加样式。

选择器的语法结构:

选择器{

  属性名1:属性值1

  属性名2:属性值2

  属性名3:属性值3

  属性名4:属性值4

}

css的注释语法

/*内容*/ 快捷键CTRL+?

css引入方式

1、在html文档中直接写style标签中

2、单独写一个css文件,然后通过link标签引入外部的css文件

3、直接写在标签上,行内式

 

基本选择器

嵌入式是将CSS样式集中写在网页的<head></head>标签对的<style></style>标签对中。
id选择器用#id{}:
#p1 {
            color: red;
            font-size: 30px;
        }

class选择器用.class{}:

.c1 {
            color: yellow;
            font-size: 25px;
        }

标签选择器(id不加符号):

p {
            color: green;
        }

通用选择符号 *:

* {
            color: orange;
        }

div下类选择器

div.c1 {
            color: red;
        }

以上选择器用来修饰这些

组合选择器