margin-right负值
来源:3-7 布局-解题-3

mike0326
2021-06-22
给 margin-right 负值为什么没有跑到 center 上边,而是跑到了 container 的 padding 位置
2回答
-
逃离外包
2022-04-24
<style>
body{
min-width: 550px;
}
#header{
text-align: center;
background-color: #f1f1f1;
}
#container{
padding-left: 200px;
padding-right: 150px;
}
#center{
background-color: #ccc;
width:100%;
}
#left{
position: relative;
background-color: yellow;
width: 200px;
margin-left: -100%;
right:200px;
}
#right{
background-color: red;
width:150px;
margin-right: -150px;
}
#footer{
clear: both;
text-align: center;
background-color: #f1f1f1;
}
#container .column{
float: left;
}
</style>
</head>
<body>
<div id="header">this is header</div>
<div id="container">
<div id="center" class="column">this is center</div>
<div id="left" class="column">this is left</div>
<div id="right" class="column">this is right</div>
</div>
<div id="footer">this is footer</div>
</body>
00 -
双越
2021-06-22
把相关代码贴出来吧。
00
相似问题