日期:2014-05-17  浏览次数:20791 次

如何让textarea占满div的宽度???
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Ajax留言板</title>
    <style type="text/css">
    #bk
    {
        width:800px;
        border:1px solid red;
        margin:0 auto;
    }
    #lyInput
    {
        width:100%;
    }
    #txtLy
    {
        width:100%; /* 为什么textarea的宽度要宽于bk的宽度,如何让它正好占满bk的宽度??? */
        height:100px;
    }
    #lyList
    {
        height:200px;
        border:1px solid blue;
        margin:10px 0 0 0;
    }
    #btnLy
    {
        display:block;
    }
    </style>
</head>
<body>
<div id="bk">
    <div id="lyInput">
        <textarea id="txtLy" rows="6" cols="80"></textarea>
        <button id="btnLy">留言啦~~~</button>
    </div>
    <div id="lyList">
        
    </div>
</div>
</body>
</html>