我试图放置宽度各为50%的两个div,但某种程度上它不在同一行上显示,但如果我做了49%,它会堆叠在同一行中。任何人都可以告诉我我在做什么错了代码(更感兴趣知道原因比解决方案)。内联两个div并排 - CSS
CSS -
* {
padding: 0;
margin: 0;
}
.wrapper {
width: 100%;
}
.left-c {
width: 50%;
background: #3EF00C;
display: inline-block;
}
.right-c {
width: 50%;
background: #2E4E6E;
display: inline-block;
}
HTML -
<div class="wrapper">
<div class="left-c">
<p>LEFT ----- This is going to be some random text placed in a a left container inside the wrapper. I hope this text will suffice the requirement.</p>
</div>
<div class="right-c">
<p>This is going to be some random text placed in a a right container inside the wrapper. I hope this text will suffice the requirement. ----- RIGHT</p>
</div>
</div>
JS小提琴 - https://jsfiddle.net/no0chhty/1/
https://jsfiddle.net/no0chhty/4/ – mika