0

我正在尝试将页面分成两个部分。左侧区域和右侧区域将是内容页面。我有以下 html,但看起来它不起作用。任何想法,我做错了什么?

<div id="wuiMainArea">
    <div id="wuiMainContent">

      <div id="wuiLeftArea">
        <div id="wuiLefthandNavRoot">
            <h2 class="wui-hidden">Section Navigation</h2>
            <h3 class="wui-navigation-title"><p>Applications</p><p>&nbsp;</p></h3>
            <div id="tree" style="float: left; width: auto; background-color: #f2f4f5;"> </div>
        </div>
        </div>

      <div id="wuiInpageNav">
            <div class="wui-inpage-container" id="in_100">
              <p>This is the div I will be using for charts </p>
            </div>
      </div>

      </div>
 </div>
4

2 回答 2

0
 #wuiMainArea, #wuiMainContent{
    margin: 0 auto;
    width: 960px;
}

 #wuiLeftArea, #wuiInpageNav{
/* use half of the main content div's width */
/* -2 because of 1px-border on both sides */
    width: 478px; 
    display: inline-block;
    float: left;
}

使用 CSS 样式化 HTML 会更好。定义宽度以满足您的需求。我还建议在将相同样式应用于多个元素时使用类而不是 id。

于 2013-02-22T19:04:41.970 回答
0

像这样

<div id="wuiMainArea" style="border: 1px solid;">
    <div id="wuiMainContent" style="border: 1px solid;">

        <div id="wuiLeftArea" style="border: 1px solid;float: left;">
            <div id="wuiLefthandNavRoot">
                <h2 class="wui-hidden">Section Navigation</h2>
                <h3 class="wui-navigation-title"><p>Applications</p><p>&nbsp;</p></h3>
                <div id="tree" style="float: left; width: auto; background-color: #f2f4f5;"> </div>
            </div>
        </div>

        <div id="wuiInpageNav" style="border: 1px solid; float: left;">
            <div class="wui-inpage-container" id="in_100">
                <p>This is the div I will be using for charts </p>
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>
</div>
于 2013-02-22T17:38:52.583 回答