css基础:选择器、尺寸、背景

CSS(层叠样式表)

定义如何显示HTML元素

1、CSS的三中引入方式:行内样式(内联),内部样式表,外部样式表

2、语法:CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明每条声明由一个属性和一个值组成

3、选择器

3.1 元素选择器 div{}

3.3 类选择器 .cl{}

3.4 ID选择器 #id{}

3.5 属性选择器 [type=‘text’]{}

优先级问题

内联 ID选择器 》类选择器 》元素选择器

4、尺寸(行内元素的宽和高不生效

   max-    min-width;

height:   max-height;    min-height;

5、背景

mso-char-indent-count:0.0000;">background-image:url(),url();

background-repeat:背景平铺

background-position:背景图位置;水平位置  垂直位置

background-attachment:背景图固定,是否滚动

background-size:背景图尺寸width height; cover全覆盖;contain扩展到最大尺寸;

多张背景图写法:background: url() no-repeat,url();

原文地址:https://www.cnblogs.com/mark645524126/p/13228187.html