<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>重叠</title>
		<!--脱离顺序流
			1 盒子有绝对位置
			2 float 属性
		-->
		<style type="text/css">
			*{
				margin: 0px;
				padding: 0px;
			}
			div{
				width: 200px;
				height: 200px;
				border: 1px solid #000000;
				float: right;
				
			}
			#left{
				background-color: #538611;
				z-index: 30;
			}
			#center{
				
				background-color: yellow;
				position: absolute;
                left:30px;
                top:40px;
                z-index: 10;
                /*这样就使三个盒子产生了重叠区域,
                 * 这个叫脱离顺序流
                 */
			}
			#right{
				background-color: greenyellow;
			}
		</style>
	</head>
	<body>
		<div id="left">
			left
		</div>
		<div id="center">绝对位置<br>left:40px;<br>top:30px;</div>
		<div id="right">right</div>
	</body>
</html>

HTML两种脱离顺序流方法

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2021-08-13
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2021-08-11
  • 2022-12-23
  • 2021-04-08
  • 2021-08-16
相关资源
相似解决方案