实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>手册网(www.shouce.ren)</title>
6
<style>
7
#main {
8
    width: 400px;
9
    height: 150px;
10
    border: 1px solid #c3c3c3;
11
    display: -webkit-flex; /* Safari */
12
    -webkit-justify-content: space-around; /* Safari 6.1+ */
13
    display: flex;
14
    justify-content: space-around;
15
}
16
17
#main div {
18
    width: 70px;
19
    height: 70px;
20
}
21
</style>
22
</head>
23
<body>
24
25
<div id="main">
26
  <div style="background-color:coral;"></div>
27
  <div style="background-color:lightblue;"></div>
28
  <div style="background-color:khaki;"></div>
29
  <div style="background-color:pink;"></div>
30
</div>
31
32
<p><b>注意:</b> Internet Explorer 10 及更早版本浏览器不支持 justify-content 属性。</p>
33
<p><b>注意:</b> Safari 6.1 及更新版本通过 -webkit-justify-content 属性支持该属性。</p>
34
35
</body>
36
</html>