Css 对齐两个DIV';s并使用整个页面宽度

Css 对齐两个DIV';s并使用整个页面宽度,css,Css,我需要对齐父div中的两个div 父div应占据页面宽度,两侧留有边距 第一个子分区的宽度应为100px,边距为4px。第二个子div必须占据剩余空间,右边有4px的边距 我该如何为此编写CSS?到目前为止,我已经写了这篇文章 div.parent { width: ?; border:1px black solid; position: relative; clear: both; } <div

我需要对齐父div中的两个div

父div应占据页面宽度,两侧留有边距

第一个子分区的宽度应为100px,边距为4px。第二个子div必须占据剩余空间,右边有4px的边距

我该如何为此编写CSS?到目前为止,我已经写了这篇文章

div.parent {

        width: ?;

        border:1px black solid;

        position: relative;

        clear: both;

        }

<div class="parent">

<div class="child1"> </div>

<div class="child2"> </div>
div.parent{
宽度:?;
边框:1px黑色实心;
位置:相对位置;
明确:两者皆有;
}

为什么不直接将边距添加到父div

<div style="height: 100px; width: 100%; padding: 4px; background-color: Yellow;">
    <div style="height: 100%; width: 100px; background-color: Lime; position: relative; float: left; border: solid 1px black; border-right-width: 0px;"></div>
    <div style="height: 100%; width: 100%; background-color: Red; border: solid 1px black; border-left-width: 0px;"></div>
</div>

为什么不直接将边距添加到父div

<div style="height: 100px; width: 100%; padding: 4px; background-color: Yellow;">
    <div style="height: 100%; width: 100px; background-color: Lime; position: relative; float: left; border: solid 1px black; border-right-width: 0px;"></div>
    <div style="height: 100%; width: 100%; background-color: Red; border: solid 1px black; border-left-width: 0px;"></div>
</div>


这里的人不喜欢为您编写代码。用到目前为止你已经提出的代码更新你的问题,以及关于你遇到的任何问题的具体问题。你应该在“CSS 2 column layout”上搜索你会发现很多信息来解决这个布局问题。我不知道如何让家长用marginFolks占据整个页面的宽度。这里的infolks不喜欢为你编写代码。用你到目前为止提出的代码更新你的问题,以及关于你遇到的任何问题的具体问题。你应该在“CSS 2 column layout”(CSS 2 column layout)上进行谷歌搜索,你会发现很多信息来解决这个布局问题。我不知道如何让家长用页边空白占据整个页面宽度