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>內(nèi)聯(lián)塊狀元素</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>