很少朋友知道的margin 百分比是按参照物来计算的
摘要:#demo{margin:0auto;width:1000px;height:500px;background:#eee;overflow:...
<style>
#demo{
margin: 0 auto;
width: 1000px;
height: 500px;
background: #eee;
overflow: hidden;
/*垂直显示,改变参照物*/
/*-webkit-writing-mode: vertical-rl;*/
/*writing-mode: tb-rl;*/
}
#demo p{
margin:10% 1%;
background: #ccc;
}
</style>
<div id="demo">
<p>我是一个p哦</p>
</div>
margin:10% 1%;
横向显示的按宽度算
垂直显示是按高度算
留作纪念。多解释。
【很少朋友知道的margin 百分比是按参照物来计算的】相关文章:
★ 火狐下easyui1.3.*弹出window框无法定位到中间问题解决
★ chrome表单自动填充导致input文本框背景变成偏黄色问题解决
★ attr()、counter()和calc()在css中的使用
下一篇:
用margin解决缩进问题