标签:相对 display color ott 技术 content 清除 position 代码块
代码块
<body>
<div class="clearfix">
<div class="c c1"></div>
<div class="c c2"></div>
</div>
<div class="c3"></div>
</body>
代码块
body {
margin: 0;
}
.c {
height: 100px;
width: 100px;
}
.c1 {
background-color: red;
float: left;
}
.c2 {
background-color: green;
float: right;
}
.c3 {
height: 200px;
width: 100%;
background-color: blue;
}
.clearfix:after {
content: "";
clear: both;
display: block;
}
代码块
<body>
<div class="c c1"></div>
<div class="c c2">
<div class="cc "></div>
</div>
<div class="c c3"></div>
<div class="ccc">top</div>
</body>
代码块
body {
margin: 0;
}
.c {
height: 100px;
width: 100px;
}
.c1 {
background-color: red;
}
.c2 {
background-color: green;
/*position: relative;*/
/*left: 100px*/
}
.c3 {
background-color: blue;
}
.cc {
height: 200px;
width: 200px;
background-color: black;
position: absolute;
top: 100px;
left: 100px
}
.ccc {
height: 50px;
width: 50px;
background-color: lawngreen;
color: white;
position: fixed;
right: 50px;
bottom: 50px;
代码块
<body>
<div class="cover"></div>
<div class="yingying"></div>
</body>
代码块
<!--遮罩层-->
.cover {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0,23,128,0.1);
z-index: 999;
}
<!--显示层-->
.yingying {
position: absolute;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -200px;
width: 400px;
height: 200px;
background-color: white;
z-index: 1000;
}
代码块
<body>
<div class="c1">c1</div>
<hr>
<div class="c2">c2</div>
</body>
代码块
.c1 {
height: 200px;
width: 200px;
background-color: red;
opacity: 0.4; <!--针对的是整体,包括文字-->
}
.c2 {
height: 200px;
width: 200px;
background-color: rgba(255,0,0,0.4);
}
标签:相对 display color ott 技术 content 清除 position 代码块
原文地址:https://www.cnblogs.com/hellosiyu/p/12489906.html