一、Basic CSS 知识整理
一、编写CSS的几种方式
<style>
/* id选择器 */
#id_test {
color: red;
} /* 标签选择器 */
h2 {
color: blue !important;
} /* 类选择器 */
.pink-text {
color: pink;
} /* [attribute=value] */
a[target=_blank] {
color: black;
}
</style>
<p id="id_test"> id test </p>
<h2>tag test <h2>
<p class="pink-text">class test</p>
<a href="http://www.baidu.com" target="_blank"> css selector test </a>
如果声明的属性冲突,那么按照 内联样式 > ID 选择器 > 类选择器 = 属性选择器 = 伪类选择器 > 标签选择器 = 伪元素选择器,同级别的按从下到上覆盖。
如果某个属性不想被覆盖,可以添加属性 !important.
二、最常见的css属性整理
<style>
.common-text {
/* 文字颜色 */
color: gray;
/* 文字大小 */
font-size: 16px;
/* 文字样式 */
font-family: monospace;
} .background-color {
/* 背景颜色 */
background-color: black;
} .size {
/* 内部间距 padding */
padding-top: 10px;
padding-right: 20px;
padding-bottom: 30px;
padding-left: 40px;
/* 以上也可以写为 padding: 10px, 20px, 30px, 40px; */ /* 外部间距 margin */
margin-top: 10px;
margin-right: 20px;
margin-bottom: 30px;
margin-left: 40px;
/* 以上也可以写为 margin: 10px, 20px, 30px, 40px; */ /* 宽度高度 */
width: 200px;
height: 200px;
}
</style>
<div class="size background-color">
<p class="common-text">常见css属性整理1</p>
</div>
慢慢整理,记住常用的,其他的可以临时查。
三、css参数化使用
<style>
/* :root 表示html标签,最高层次 */
:root {
/* 定义两个参数 */
--total-text-color: red;
--total-text-background: black;
} /* 使用参数 */
.test1 {
color: var(--total-text-color, black);
} .test2 {
color: var(--total-text-color, gray);
background-color: var(--total-text-background, black);
} /* 重写参数 */
.test3 {
--total-text-color: blue;
}
.test3 p{
color: var(--total-text-color, gray);
}
</style> <p class="test1">test1</p>
<div class="test2">
<p>test2</p>
</div>
<div class="test3">
<p>test3</p>
</div>
一、Basic CSS 知识整理的更多相关文章
- html+css知识整理
1.学网页最好的方法:学习别人的网页. 2.文档结构 <html>(超文本标记语言) <head> <title> </title> & ...
- html+css 知识整理
1.学网页最好的方法:学习别人的网页. 2.文档结构 <html>(超文本标记语言) <head> <title> </title> & ...
- CSS知识整理
1. 权重问题(CSS优先级): 继承或 * :0,0,0,0 标签:0,0,0,1 每个类,伪类:0,0,1,0 每个ID:0,1,0,0 每个行内式:1,0,0,0 !important:无穷大 ...
- css与JS知识整理
CSS知识 CSS选择器:基础中的核心,选择器指明了{}中“样式”作用的对象,也就是“样式”作用于网页中的哪些元素. CSS选择器类型:一共三大类. 基础选择器 属性选择器 组合选择器 ...
- wifi基础知识整理
转自 :http://blog.chinaunix.net/uid-9525959-id-3326047.html WIFI基本知识整理 这里对wifi的802.11协议中比较常见的知识做一个基本的总 ...
- 【转】WIFI基本知识整理
WIFI基本知识整理 这里对wifi的802.11协议中比较常见的知识做一个基本的总结和整理,便于后续的学习.因为无线网络中涉及术语很多,并且许多协议都是用英文描述,所以有些地方翻译出来会有歧义,这种 ...
- 《HTML与CSS知识》系列分享专栏
收藏HTML和CSS方面的技术文章,作为一个WEB开发者,必须要知道HTML和CSS方面的知识,即使作为后台开发者也应该知道一些常用的HTML和CSS知识,甚至架构师也要了解,这样才会开发出实用的网站 ...
- Web前端基础怎么学? JavaScript、html、css知识架构图
以前开发者只要掌握 HTML.CSS.JavaScript 三驾马车就能胜任一份前端的工作了.而现在除了普通的编码以外,还要考虑如何性能优化,如何跨端.跨平台实现功能,尤其是 AI.5G 技术的来临, ...
- js事件(Event)知识整理
事件(Event)知识整理,本文由网上资料整理而来,需要的朋友可以参考下 鼠标事件 鼠标移动到目标元素上的那一刻,首先触发mouseover 之后如果光标继续在元素上移动,则不断触发mousemo ...
- CSS知识回顾--读《CSS 那些事儿》笔记
由于之前有了解过CSS的相关知识,有了一定的基础,所以读起<CSS 那些事儿>不是很有难度,况且我现在读起来时,CSS3和HTML5比较流行,这里只是记录一些CSS知识记录,不做详细铺开, ...
随机推荐
- Ubuntu下CodeBlocks控制台程序中文显示乱码解决问题
今天在CodeBlocks下折腾来半天,终于把中文乱码给解决了,其实很简单. 在环境设置里进行如下设置:把Terminal to launch console programs那个选项改成gnome- ...
- nginx ip段限制
deny 123.0.0.0/8; // 封 123.0.0.1~123.255.255.254 这个段的ip deny 123.1.0.0/16; // 封 123.1.0.1~123.1.255. ...
- TP5 事务处理加锁
首先,数据库类型要是InnoDB,其次,加锁必须跟事务同时使用,还有,查询的时候都必须带锁,比如: db('sms')->lock(true)->where(['id'=>1])-& ...
- 1071 - Specified key was too long; max key length is 767 bytes
set global innodb_large_prefix=on;set global innodb_file_format=BARRACUDA; 主从都要修改以上2个参数.
- 【C++复习】5.7 多文件结构与编译预处理命令
1.C++项目结构 C++程序的一般组织架构 类声明文件(.h文件) 类实现文件(.cpp文件) 类的使用文件(main()所在的.cpp文件) 用工程组合各文件 2.编译链接 编译链接过程 3.外部 ...
- maven重点分析
目录 什么是maven pom.xml 约定大于配置 根元素和必要配置 父项目和parent元素 项目构建需要的信息 路径管理 资源管理 详细使用 filtering的使用 怎么理解pom中多个res ...
- mfcc vs fbank
There is some debate in the community regarding the use of the DCT, instead of directly using the lo ...
- rust字节数组转换为string
一.String::from_utf8 fn main() { let bytes = vec![0x41, 0x42, 0x43]; let s = String::from_utf8(bytes) ...
- jq-Grid 能折叠的表格
有一个需求是需要用jq-Grid展示一个可以折叠的表格,并且要求在页面初始化的时候就将表格折叠起来,我看了一下文档可以给列表增加 toolbar: [true, "top"],ca ...
- Python使用requests和requests_toolbelt上传文件
1.requests-toolbelt官方文档:https://pypi.org/project/requests-toolbelt/ 2.环境安装 pip install requests-tool ...