查看完整代码:
.one {
position: relative;
display:inline-block;
width:70px;
background-color: #ddd;
}
.two {
position: relative;
display:inline-block;
width:80%;
background-color: #ddd;
}
我想设置 .one 和 .two div 顶部对齐,其中 .two div 将响应宽度和高度。
这里我在 .two div width: 80%;
中使用了也不是全宽。
最佳答案
如果我理解正确的话,这应该有效:
.one {
position: relative;
top: 0;
float: left;
width:70px;
background-color: #ddd;
}
.two {
position: relative;
top: 0;
float: left;
width:80%;
background-color: #ddd;
}
关于html - 如何设置两个相对位置div对齐top,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27401021/