Element classification--inline block elements

inline-block element characteristics:

Inline block elements (inline-block) have the characteristics of both inline elements and block elements. The code display:inline-block is to set the element to inline Connected block elements. (New in css2.1), <img> and <input> tags are such inline block tags.

1, and other elements are on the same line;

2, the height, width, line height, top and bottom margins of the element can be set.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>内联块状元素</title>
<style type="text/css">
a{
    display:inline-block; 
         width:20px;/*在默认情况下宽度不起作用*/
         height:20px;/*在默认情况下高度不起作用*/
         background:pink;/*设置背景颜色为粉色*/
         text-align:center; /*设置文本居中显示*/
}
</style>
</head>
<body>
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
</body>
</html>


Continuing Learning
||
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<style type="text/css">
a{
display:inline-block;
width:20px;/**/
height:20px;/**/
background:pink;/**/
text-align:center; /**/
}
</style>
</head>
<body>
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
submitReset Code
图片放大关闭