国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

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)元素之后,我們?cè)O(shè)置寬高,背景色,文字顏色*/
		width:300px;
		height:200px;
		background-color:green;
		color:red;
	}
</style>
</head>
<body>
  	<div>歡迎大家來(lái)到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)元素之后,我們?cè)O(shè)置寬高,背景色,文字顏色*/ width:300px; height:200px; background-color:green; color:red; } </style> </head> <body> <div>歡迎大家來(lái)到php中文網(wǎng)</div> </body> </html>
submitReset Code