0702固定定位
程序员文章站
2022-06-02 19:29:42
...
0702作业
制作一个在线QQ客服的固定定位
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.image {
width: 5em;
}
.kefu {
position: relative;
height: 900em;
}
.image {
position:fixed;
top: 20em;
bottom: 0;
right: 0;
}
</style>
</head>
<body>
<div class="kefu">
<img src="https://img0.baidu.com/it/u=3464795985,1960072882&fm=26&fmt=auto" alt="" class="image">
</div>
</body>
三行三列的定位布局
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body *:not(.container) {
background-color: lightgreen;
}
:root {
/* rem布局 */
font-size: 10px;
}
body {
font-size: 1.6rem;
}
header ,
footer {
height: 5rem;
/* background-color: lightblue; */
}
.container {
margin: 0.5rem 0;
min-height: calc(100vh - 11rem);
position: relative;
}
.container aside {
width: 20rem;
min-height: inherit;
position: absolute;
}
.container aside:first-of-type {
left: 0;
top: 0;
}
.container aside:last-of-type {
right: 0;
top: 0;
}
.container main{
position:absolute;
left: 20.5rem;
right: 20.5rem;
/* background-color: lightgreen; */
min-height: inherit;
}
</style>
</head>
<body>
<header>页眉</header>
<div class="container">
<aside>左侧</aside>
<main>内容区</main>
<aside>右侧</aside>
</div>
<footer>页脚</footer>
</body>
上一篇: 请问PHP写文件写数据库性能有关问题