提示:背景颜色、背景图片、背景平铺、背景图片位置、背景固定位置等。
1、语法:
div{
background-color:"pink";
}
注意:
(1)、“transport”表示透明,放到属性值里面,例如:
background-color:"transport | color";
(2)、在背景颜色,后面属性值还可以用“数值”,比如:
background-color:"#235";
自己代码展示:
<!--
* @Author: error: git config user.name && git config user.email & please set dead value or install git
* @Date: 2022-06-02 18:00:09
* @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
* @LastEditTime: 2022-08-28 11:04:17
* @FilePath: \code\前端代码\css学习知识\css背景\3css背景.html
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>背景透明</title>
<style>
div {
width: 200px;
height: 200px;
/* background-color: transparent; */
/* 这里背景颜色如果我们不设置一般默认是透明的、“transparent”透明 */
background-color: pink;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
显示结果:
总结
提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了css背景颜色。