#使用 margin(向外)、padding(向内) 来推挤距离
css:
.box{border:10px solid #000;
padding-left:30px;
padding-right:30px;}
向内留白30px
!
https://ithelp.ithome.com.tw/upload/images/20201105/20132398TPwEB4oEXZ.png
.box p{margin-bottom: 50px;} 推下边界50pixal
向外留白50px
向外留白後box2被往外推
精诚所至,金石为开!大浪掏沙,是金子够质量才能留下
#Box Model(盒模型)
CSS:
.box{width:300px;height:300px;background:#000}
*滑鼠滑到.box会看到对应高度是300px*
border padding 内部 画实线黑色;外部margin是在实线之外画虚线所以上下两个box中间白色的30px就是margin造成的
#使用 margin: auto 让版型置中
yahoo首页,视窗拉右,中间的内容会保持致中随着视窗移动而变化还是保持致中
html:
<body>
<div class="header"></div>
<div class="content"></div>
</body>
CSS:
.header{width:900px;heith
}
.content{width:900px;}
以上这样是不够的 不会致中
<body>
<div class="wrap">
<div class="header"></div>
<div class="content"></div>
</body>
CSS:
.wrap{width:900px;
margin-left:auto;
margin-right:auto;} 自动外推左右 就会自动致中了
.header{width:900px;heith
}
.content{width:900px;}
![https://ithelp.ithome.com.tw/upload/images/20201105/20132398gwcVgOcD8B.png]
*如果拿掉宽度,只有margin-left:auto;margin-right:auto是不够的 (https://ithelp.ithome.com.tw/upload/images/20201105/20132398gwcVgOcD8B.png)
再加个footer
html:
margin:0 auto 0 auto 这个代表 上右下左
<<: 【Youtube影片】Windows 不用滑鼠快速搜寻/安装 Chocolatey 平台上软件
Filebeat是用於转发和集中日志数据的轻量级传送程序。作为服务器上的代理安装,Filebeat监...
我们先来画我们的计数器吧! 为了让我们的计数器精美一点点点, 我们先来安装React的fontAwe...
JavaScript的物件基於「原型」的继承,可以令一个物件「继承另一个物件的属性」。具体上,以 O...
前言 上次我们提到原始文本往往夹带大量无意义的字符,於是我们利用了正则表达式来清理资料。然而此时的文...
上一篇定义了IAM里面会看到的名词,今天我们来看一下AWS Console里面要怎麽建置IAM Us...