1. 程式人生 > >DIV+CSS布局(一)

DIV+CSS布局(一)

meta eight -c text pad 500px spa idt pan

1.div和span

  DIV和SPAN在整個HTML標記中,沒有任何意義,他們的存在就是為了應用CSS樣式

  DIV和SPAN的區別在與,span是內連元素,div是塊級元素

2.盒模型

  margin:盒子外邊框

  padding:盒子內邊框

  border:盒子邊框寬度

  width:盒子寬度

  height:盒子高度

eg:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DIV+Css布局(div+span以及盒模型)</title>
<style type="text/css">
div{
background-color: green;
color: #ffffff;
width: 500px;
height: 500px;
padding: 10px;
}
span{
background-color: green;
color: #ffffff;
}
body{
margin: 0px;
border: 10px;
padding: 10px;
}
</style>

</head>
<body>
<div>第十四天div</div>
<div>第十四天div</div>
<span>第十四天div</span>
<span>第十四天div</span>
</body>
</html>

DIV+CSS布局(一)