p {
font-size: 20px;
line-height: 1.5;
}
.fixed {
position: fixed;
top: 50px;
left: 50px;
width: 200px;
height: 100px;
background-color: white;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}在上面的代码中,我们首先设置了段落的样式,然后使用“.fixed”选择器选中要固定的元素,并设置了其“position:fixed”属性和“top”和“left”属性。我们还设置了这个元素的宽度、高度、背景颜色和阴影样式。
使用上述代码,我们可以将任何需要固定在屏幕上的元素,设置为滑动固定布局,并让网站看上去更加炫酷。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did222053