随笔分类 -  CSS

摘要:CSS三大特性—— 继承、 优先级和层叠。 继承:即子类元素继承父类的样式; 优先级:是指不同类别样式的权重比较; 层叠:是说当数量相同时,通过层叠(后者覆盖前者)的样式。 css选择符分类 首先来看一下css选择符(css选择器)有哪些? 1.标签选择器(如:body,div,p,ul,li) 2 阅读全文
posted @ 2022-03-22 18:12 向前、向前 阅读(158) 评论(0) 推荐(0) 编辑
摘要:冲突设置: button.btn { background-color: inherit; float: left; border: none; outline: none; cursor: pointer; padding: 14px 16px; transition: 0.3s; font-si 阅读全文
posted @ 2022-03-22 14:50 向前、向前 阅读(185) 评论(0) 推荐(0) 编辑
摘要:实例 指定每个 p 元素匹配的父元素中第 2 个子元素的背景色: p:nth-child(2) { background:#ff0000; } 定义和用法 :nth-child(n) 选择器匹配父元素中的第 n 个子元素,元素类型没有限制。 n 可以是一个数字,一个关键字,或者一个公式。 实例 1 阅读全文
posted @ 2022-03-17 14:09 向前、向前 阅读(35) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html><html><head><style> div { -webkit-user-select: none; /* Safari */ -ms-user-select: none; /* IE 10 and IE 11 */ user-select: none; /* St 阅读全文
posted @ 2022-03-17 11:05 向前、向前 阅读(154) 评论(0) 推荐(0) 编辑
摘要:img { max-width: 100%; height: auto;}最大宽度是以图片真实宽度 img {width: 100%; height: auto;}设置img元素宽度为屏幕宽度 阅读全文
posted @ 2022-01-25 13:58 向前、向前 阅读(539) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示