CSS
html {
-webkit-filter: grayscale(100%) !important;
-moz-filter: grayscale(100%) !important;
-ms-filter: grayscale(100%) !important;
-o-filter: grayscale(100%) !important;
filter: grayscale(100%) !important;
filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1) !important;
}
关键在于transform: translate(-50%, -50%);
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
这两个背景图CSS样式很有用:
background-attachment:fixed, background-size:cover
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_parallax_percent
https://www.w3schools.com/CSSref/css3_pr_background-size.asp
width: calc(100% - 100px);
为了便于观察,我把边框尺寸做成不一样。
<div style="position:relative">
<div style="width:100px;height:100px;border:3px solid #f00"> </div><div style="width:100px;height:100px;border:1px solid #00f;position:absolute;top:0;left:0"> </div>
</div>
热门内容
最新内容
- 1 天 15 小时 ago
- 2 天 12 小时 ago
- 3 天 9 小时 ago
- 6 天 12 小时 ago
- 1 周 3 天 ago
- 2 周 1 天 ago
- 2 周 3 天 ago
- 3 周 ago
- 3 周 2 天 ago
- 1个月 ago
最新评论