1.背景颜色
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>css常用属性</title>
<style>
#div1{
width:500px;
height:400px;
background-color: #164481;
}
#div2{
color:#0000FF;/**字体颜色设置*/
text-align:center;
text-decoration: line-through overline;
/*首行缩进*/
text-indent:2em;
}
</style>
</head>
<body>
<div id="div1">
hello
</div>
<div id="div2">
hello
</div>
</body>
</html>
运行结果
2.去除超链接的下划线
<style>
a{
/*去除超链接的下划线*/
text-decoration: none;
}
</style>
3.display
4.浮动(两个div在一行)
<style>
#d1{
width:100px;
height:100px;
background-color: aqua;
float: left;
}
#d2{
width:100px;
height:100px;
background-color: #0000FF;
float:left;
}
</style>
<div id="d1"></div>
<div id="d2"></div>
5.盒子模型