写完了论文就又拿起丢了的HTML5,先把基础东西看一遍,写这些来当笔记用,巩固一下。id(用#)class(用.),通配符(*{})
盒子模型:
内边距属性:
padding:设置所有边距
padding-bottom:设置底边距
padding-left:设置左边距
padding-right:设置右边距
padding-top:上边距
边框的样式border-style ,border-width ,border-color
也可以分别设置边框样式:border-top(left\right\bottom)-style(width\color)
CSS3边框样式:
border-radius :圆角边框
box-shadow :边框阴影 参数:向右移动多少像素 向下移动像素 阴影透明度 颜色
border-image :边框图片
外边距margin属性,与内边距padding相似。
外边距合并:自动进行的
盒子模型应用实例
index.html文件
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>盒子模型的应用</title>
<link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="top">
<div class="top_content"></div>
</div>
<div class="body">
<div class="body_image"></div>
<div class="body_content">
<div class="body_no"></div>
</div>
</div>
<div class="footing">
<div class="footing_content"></div>
<div class="footing_menu"></div>
</div>
</body>
</html>
style.css文件
*{
margin: 0px;
padding: 0px;
}
.top{
width:100%;
height:50px;
background-color: darksalmon;
}
.top_content{
width: 75%;
height: 50px;
margin: 0px auto;
background-color: beige;
}
.body{
margin: 20px auto;
width: 75%;
height: 1000px;
background-color: darkgoldenrod;
}
.body_image{
width: 100%;
height: 400px;
background-color: darksalmon;
}
.body_content{
width: 100%;
height: 600px;
background-color: bisque;
}
.body_no{
width: auto;
height: 30px;
background-color: cadetblue;
}
.footing{
width: 75%;
height: 200px;
background-color: cornflowerblue;
margin: 0px auto;
}
.footing_content{
width: auto;
height: 100px;
background-color: darkgrey;
}
.footing_menu{
width: auto;
height: 100px;
background-color: khaki;
}