CSS min-height不会调整背景颜色和边框

时间:2012-06-17 16:26:53

标签: border background-color css

我正在建立这个网站的问题。我需要一个固定的宽度,这样我可以做左边距和右边边距自动(在我的'左窗口'中将表单项居中。问题是我正在尝试使这个代码模块化,以便它可以适用于任何未来我决定创建表单,这意味着我需要一个可变高度,具体取决于表单需要多少个字段。

所以为了澄清上面的陈述,我试图保持固定宽度并具有可变高度(使用最小高度)。问题是背景颜色和div边界不随着div大小而缩小或扩展。任何想法?

该网站位于:http://traelid.com/news/createNews.php

这是我的表单代码和我的CSS代码:

FORM:

<script type='text/javascript' src='../nicEdit/nicEdit.js'></script>
<script type='text/javascript'>
    bkLib.onDomLoaded(function() {nicEditors.allTextAreas() });
</script>

<div class='frmcontainer'>

    <div class='title'>TraeLid News</div>

  <div class='fill'>

        <div class='row'>

            <div class='frm lbl'>
                <label for='author'>Author:</label>
            </div>

            <div class='frm itm'>
                Auto Author
            </div>

        </div>

        <div class='row'>

            <div class='frm lbl'>
                <label for='subject'>Subject:</label>
            </div>

            <div class='frm itm'>
                <input class='itm itmtxt' type='text' name='subject' />
            </div>

        </div>

        <div class='row'>

            <div class='frm lbl'>
                <label for='content'>Content:</label>
            </div>

            <div class='frm itm txtarea' style='background-color:#fff;'>
              <textarea class='itm itmtxtarea ckeditor' name='content'></textarea>
          </div>

        </div>

        <div class='row'>

            <div class='frm lbl'>
                <label for='tags'>Tags:</label>
            </div>

            <div class='frm itm'>
                <input class='itm itmtxt' type='text' name='tags' />
            </div>

        </div>

  </div>


</div>

CSS:

 .frmcontainer
    {

    text-align:center;

    width:750px;
    min-height:200px;
    margin-left:auto;
    margin-right:auto;

    border-radius:10px;
    border-width:1px;
    border-style:solid;

}

.frm
{
    margin:5px;
}


.title
{
    clear:both; 

    width:750px;

    margin-bottom:24px;

    font-size:28px;
    font-weight:bold;
    text-decoration:underline;
    font-variant:small-caps;

}

.row
{
    width:750px;
    height:auto;

    float:left;
    clear:both;
}

.lbl
{   
    font-size:18px;
    font-weight:bold;

    text-align:left;

    height:30px;
    width:150px;

    float:left;

}

/*Container and input styles*/

.itm
{
    text-align:left;

    height:25px;
    width:580px;        

    float:left;
}

.itmtxt
{
    width:576px;

    border-style:solid;
    border-width:1px;
}

.txtarea
{
    height:400px;
}

.itmtxtarea
{
    width:578px;

    height:343px;

    border-style:solid;
    border-width:1px;
}
.nicEdit-panel 
{     
    background-color: #eee;
}
.nicEdit-selected 
{     
    background-color: #fff;
    word-wrap:break-word;;
    overflow:hidden;
}
.nicEdit-main
{
    word-wrap:break-word;
    overflow:hidden;
    max-height:343px;
}

1 个答案:

答案 0 :(得分:1)

on .frmcontainer add overflow: hidden;fiddle ex