批改状态:合格
老师批语:同学, 是刚报名的吗?尽快跟上进度

<style>.container{width:300px;height:200px;background-color:lightgreen;/* 位置调整 */margin-top:10px;margin-left:10px;/* 大小与计算 */border:5px solid red;padding:10px;/* 此时该块的大小为 内边距10*2+宽300+边框5*2=330 经QQ截图工具测量计算正确 */}</style></head><body><div class="container">盒模型大小与位置</div></body>
经查 box-sizing 一共有三个值分别是 content-box(内容) border-box(边框) inherit(继承)


<style>*{padding:0;margin:0;}.container{width:390px;background-color:coral;right:10px;bottom:10px;/* 使用下面定位语句后,位置才发生变化 */position:fixed;/* 外观简单设置 */text-align:center;/* 设置圆角 */border-radius:8px;color:white;padding:5px;font-weight:600px;}</style></head><body><div class="container">固定广告位</div>



<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>浮动实现三列布局</title><style>*{margin:0;padding:0;box-sizing:border-box;}.main{width:800px;min-height:700px;background-color:lightcoral;}.left,.right{width:200px;background-color:lightgreen;min-height:700px;}.left{float:left;border:5px solid white;}.content{width:400px;background-color:lightskyblue;min-height:700px;float:left;border:5px solid white;}.right{float:right;border:5px solid white;}</style></head><body><div class="main"><div class="left">左侧</div><div class="content">中间</div><div class="right">右侧</div></div></body></html>

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>圣杯布局</title></head><style>.container {background-color: lightcoral;overflow: hidden;padding: 0 200px;}.container > * {min-height: 600px;float: left;}.main {width: 100%;background-color: lightgreen;}.container > .left,.container > .right {width: 200px;background-color: lightskyblue;position: relative;}.container > .left {margin-left: -100%;right: 200px;}.container > .right {margin-left: -200px;left: 200px;}</style><body><div class="container"><div class="main">内容主体内容主体内容主体内容主内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容主体内容</div><div class="left">左侧</div><div class="right">右侧</div></div></body></html>

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号