这是我用来制作列的 CSS
<style>
h1{background-color:black;
color: white;
}
.columnA{f
float: left;
width: 70%;
margin:0;
}
.columnB{
float: right;
width:30%;
margin: 0;
}
div.clear{clear:both;}
</style>
这是HTML
<div class="container">
<div class="columnA">
Lorem ipsum dolor sit amet
</div>
<div class="columnB">
Test 1<br>
Test 2
</div>
</div>
最后看起来第二个 div 不会向上移动。我也试过 float: left 。
最佳答案
你有语法错误.. 将 f float
更改为 float in .columnA
.columnA{
f float: left;
width: 70%;
margin:0;
}
应该是
.columnA{
float: left;
width: 70%;
margin:0;
}
检查这个fiddle
这是你的 original code
关于html - 我正在尝试制作两列,但第二列的位置不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17094158/