【发布时间】:2015-05-05 06:18:38
【问题描述】:
我有两个 div,我要把它们并排排列,我为它们设置了 display inline-block 但没有工作,其中一个比另一个更高级。
我想要这个:
HTML:
<header>
THIS IS HEADER
</header>
<div id="content">
<div id="fori-div" class="inline-st">Something will come here with some tabs...</div>
<div id="send-ads" class="inline-st">
<textarea id="send-ads-textarea" placeholder="Please write here...."/></textarea>
<div id="product-list">
<a href="#">Refrence 1</a>
<a href="#">Refrence 2</a>
<a href="#">Refrence 3</a>
<a href="#">Refrence 4</a>
</div>
</div>
</div>
<footer>THIS IS FOOTER</footer>
css:
html,body{
border:0;
margin: 0;
padding: 0;
box-sizing: border-box;
direction: rtl;
}
header,footer{
background: wheat;
border-top: 3px solid red;
border-bottom: 3px solid red;
}
#content{
text-align: center;
}
.inline-st{
display: inline-block;
position: relative;
}
#send-ads{
width:613px;
height: 235px;
background: white;
border:1px solid #d6d6d6;
padding: 14px;
}
#send-ads-textarea{
width:581px;
height: 131px;
border:1px solid #dbdbdb;
resize: none;
padding:3px;
}
/*End #content> #send-ads*/
#fori-div{
height: 235px;
width:388px;
background: green;
}
#product-list{
background: red;
margin-top:41px;
height: 33px;
}
#product-list a{
width:48px;
height: 33px;
display: inline-block;
background: yellow;
}
但无法正常工作且未以上述样式显示(图片)。 DEMO
当我向右 div (#second-div) 添加一些内容时,它会出现并从右到左排列左 div (#ads-div)。 DEMO
请帮忙告诉我正确的 CSS 和 HTML
【问题讨论】: