基本上我有一个 div 父元素,它由 1+ div 子元素组成(每个子元素中都有一个按钮)。现在我希望按钮填充父项的整个宽度 - 但要分享它。也就是说,如果有一个子按钮,它应该填充 100% - 如果有 2 个,它们的宽度应该是每个大小的 50%,依此类推。
我怎样才能做到这一点?
编辑:根据要求-这是代码(尽管我认为上面的解释更好):
.buttons
{
    background: #f1f1f1;
    border-top: 1px solid #ddd;
    padding: 15px;
    height: 34px;
}
.submitbutton
{
    width: inherit;
    background: #C2E5FC; /* Old browsers */
    background: -moz-linear-gradient(top, #C2E5FC 0%, #008BE8 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E5FC), color-stop(100%,#008BE8)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #C2E5FC 0%,#008BE8 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #C2E5FC 0%,#008BE8 100%); /* Opera11.10+ */
    background: -ms-linear-gradient(top, #C2E5FC 0%,#008BE8 100%); /* IE10+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E5FC', endColorstr='#008BE8',GradientType=0 ); /* IE6-9 */
    background: linear-gradient(top, #C2E5FC 0%,#008BE8 100%); /* W3C */
    border: 1px solid #008BE8;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border-radius: 20px;
    line-height: 20px;
    font-size: 16px;
    padding: 6px 12px;
    color: #fff;
    text-shadow: -1px -1px #008BE8;
    margin-left: 10px;
    cursor: pointer;
}
的HTML:
<div class="buttons">
    <input class="submitbutton" type="submit" value="Register">
    <input class="submitbutton" type="submit" value="Cancel">
</div>
    