亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

HTML+CSS Easy to Get Started with Inline Elements

In HTML, <span>, <a>, <label>, <strong> and <em> are typical inline elements (inline elements). Of course, block elements can also be set to inline elements through code

display:inline


##inline Element features:

1. It is on the same line as other elements;

2. The height, width and top and bottom margins of the element cannot be set;

3. The element The width of is the width of the text or image it contains and cannot be changed.

Let’s write a piece of code below. The width and height can be set for block elements, but the width and height cannot be set for inline elements.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
	a{
		width:100px;
		height:50px;
		background-color:green;  /*設(shè)置背景色*/
		color:#fff;  /*設(shè)置字體顏色*/
	}
</style>
</head>
<body>
   <a href="#">PHP中文網(wǎng)</a>
</body>
</html>

Look at the above code, a is an inline element, When we set the width and height, it has no effect. Converting it to block elements will have obvious effects.

Let’s write an example below to convert block elements into inline elements

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
	div{
		display:inline;  /*轉(zhuǎn)換成內(nèi)聯(lián)元素*/

		/*轉(zhuǎn)換成內(nèi)聯(lián)元素之后,我們設(shè)置寬高,背景色,文字顏色*/
		width:300px;
		height:200px;
		background-color:green;
		color:red;
	}
</style>
</head>
<body>
  	<div>歡迎大家來到php中文網(wǎng)</div>
</body>
</html>

Above In the code, after the block element is converted into an inline element, the width and height cannot be set

Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> div{ display:inline; /*轉(zhuǎn)換成內(nèi)聯(lián)元素*/ /*轉(zhuǎn)換成內(nèi)聯(lián)元素之后,我們設(shè)置寬高,背景色,文字顏色*/ width:300px; height:200px; background-color:green; color:red; } </style> </head> <body> <div>歡迎大家來到php中文網(wǎng)</div> </body> </html>
submitReset Code