-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathli-center-alignment.html
More file actions
55 lines (55 loc) · 1.15 KB
/
li-center-alignment.html
File metadata and controls
55 lines (55 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Element Li Centered alignment</title>
<style type="text/css">
ul, li
{
margin: 0;
padding: 0;
}
ul
{
list-style: none;
}
.box
{
border: 1px solid #ECEDF0;
height: 38px;
line-height: 38px;
}
.box ul
{
width: 100%;
height: 38px;
text-align: center;
}
.box ul li
{
border: 1px solid #ccc;
margin: 8px 10px;
width: 20px;
height: 20px;
line-height: 20px;
display: inline-block;
}
*+html .box ul li
{
display: inline;
}
</style>
</head>
<body>
<p>1. Set ul style as "text-align: center;"</p>
<p>2. Set li style as "display: inline-block;", below IE7 as "display: inline;"</p>
<div class="box">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</div>
</body>
</html>