我有一个简单的div,其中我有2个textarea.我将textarea的宽度设置为100%但是它稍微偏离了div. 见这fiddle. HTML: div class="offer_a_help" textarea/textarea br/ textarea/textarea/div CSS: .offer_a_help { width: 35
          见这fiddle.
HTML:
<div class="offer_a_help">
    <textarea></textarea>
    <br/>
    <textarea></textarea>
</div> 
 CSS:
.offer_a_help {
    width: 350px;
    height: 250px;
    position: absolute;
    top: calc(100%/2 - 350px/2);
    left: calc(100%/2 - 250px/2);
    background-color: #eee;
    border-radius: 5px;
    border: 1px solid #bbb;
}
.offer_a_help textarea {
    width: 100%;
} 
 为什么会发生这种情况,解决这个问题的最简单方法是什么?
您需要重置填充和边距(我将边距设置为-1以容纳外部div边框):Demo
.offer_a_help textarea {
    width: 100%;
    margin: 3px -1px;
    padding: 0;
}
        
             