本文主要是介绍层叠属性的认识,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
层叠属性(要在定位环境下使用) z-index
属性值:number
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Document</title><style>div{position: fixed}div:nth-child(1){width: 300px;height: 300px;background: pink;z-index:1}div:nth-child(2){width: 200px;height: 200px;background: green;z-index: 2}div:nth-child(3){width: 100px;height: 100px;background: orange}</style>
</head>
<body><div>金来</div><div>昕旭</div><div>胜平</div>
</body>
</html>
效果图 :
这篇关于层叠属性的认识的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!