标签三种显示模式转换display

标签三种显示模式转换display

前端知识qingyu2020-11-07 12:47:181120A+A-

  标签显示模式转换display

  块转行内 display:inline;

  行内转块 display:block;

  块,行内转行内块 display:inline-block;

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			span {
				display: block;
				width: 100px;
				height: 200px;
				background-color: #008000;
			}
			div {
				display: inline;
				background-color: #FF0000;
			}
			a {
				display: inline-block;
				width: 200px;
				height: 100px;
				background-color: #0000FF;
			}
		</style>
	</head>
	<body>
		<span>我是行内元素</span>
		<span>我是行内元素</span>
		<div>我是块元素</div>
		<div>我是块元素</div>
		<a href="">百度</a>
		<a href="">新浪</a>
	</body>
</html>

标签三种显示模式转换displayg

点击这里复制本文地址 欢迎来到大黄鸡源码分享网
qrcode

大黄鸡源码编程网 © All Rights Reserved.  
网站备案号:闽ICP备18012015号-4
Powered by Z-BlogPHP
联系我们| 关于我们| 广告联系| 网站管理