一 盒子高度
<style>
div {
background-color: red;
font-size: 50px;
}
</style>
</head>
<body>
<div>c默认文字</div>
二 背景图片
<style>
div {
/* background-image: url('./img/1.jpg'); */
background-image: url('./img/img_flwr.gif');
width: 600px;
height: 400px;
background-color: red;
}
</style>
</head>
<body>
<div></div>
三 盒子边框
<!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>Document</title> -->
<style>
div {
width: 300px;
height: 200px;
/* border:边框宽度 边框样式 边框颜色 四个反向都是一样的 */
/* border: 2px solid red; */
/* 边框 solid: 实线 dotted:点线 dashed:虚线 double:双实线 */
/* 上边框 --- 总体设置 */
/* border-top: 10px solid red; */
/* 上边框 --- 分开设置 */
border-top-width: 10px;
border-top-style: solid;
border-top-color: red;
/* 右边框 */
/* border-right: 5px dotted green; */
border-right-width: 5px;
border-right-style: dotted;
border-right-color: green;
/* 下边框 */
/* border-bottom: 10px dashed darkmagenta; */
border-bottom-width: 10px;
border-bottom-style: dashed;
border-bottom-color: darkmagenta;
/* 左边框 */
/* border-left: 20px double salmon; */
border-left-width: 20px;
border-left-style: double;
border-left-color: salmon;
/* 宽度综合 上右下左 */
border-width: 30px;
border-width: 10px 20px 30px 40px;
border-width: 20px 40px;
/* 样式综合 */
border-style: dashed;
border-style: solid dotted dashed double;
border-style: dashed dotted solid;
/* 颜色综合 */
border-color: red;
border-color: yellowgreen blue;
/* 最终综合 */
border: 20px solid blueviolet;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
四 边框圆角
<!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>Document</title> -->
<style>
div {
width: 400px;
height: 300px;
background-color: red;
/* 宽度*50% 高度*50% 横向纵向的一共圆角设置 */
/* border-radius: 50%; */
/* 左上角 */
/* border-top-left-radius: 200px; */
/* 右上角 */
/* border-top-right-radius: 200px; */
/* 右下角 */
/* border-bottom-right-radius: 200px; */
/* 左下角 */
/* border-bottom-left-radius: 200px; */
/* 四个角200px */
/* border-radius: 200px; */
/* 左上角 右上角 右下角 左下角顺序取值 如果某个角没有 就从对角取值 */
border-radius: 10px 40px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
五 盒子阴影
<!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>Document</title> -->
<style>
div {
width: 200px;
height: 150px;
margin: 50px 400px;
background-color: red;
}
/* div:hover {
box-shadow: 0px 0px 20px 20px #000 inset;
} */
div:hover {
box-shadow: 0 15px 30px rgba(0,0,0, .5);
}
</style>
</head>
<body>
<div></div>
<!--
box-shadow 外部
水平阴影位置 必须 增大 右
垂直阴影位置 必须 增大 下
阴影模糊距离 可选 值越高 就越模糊
阴影尺寸 可选 向外延展的尺寸
阴影颜色 可选
外部or内部 可选
内部:
-->
</body>
</html>