我有以下代码:我应该使用DIVS还是display:table?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<style type="text/css">
body, html{
height: 100%;
}
#outer {
width: 90%;
height: 90%;
margin: 5% 5% 5% 5%;
background-color: #333;
}
#left-content {
height: 100%;
width: 50%;
}
#right-content {
height: 100%;
width: 50%;
}
</style>
<div id="outer" style="display: block">
<div id="left-content" style="display: block; background-color: red;">xx</div>
<div id="right-content" style="display: block; background-color: yellow;">xx</div>
</div>
</body>
</html>
外DIV周围有边距和内部是两个div。我想让两个DIV并排,但似乎一个在另一个之下。
如何让他们并排?
另一个相关的问题。对于这样的事情,最好使用display:table和table-cell?
要回答你的第二个问题:http://stackoverflow.com/questions/83073/why-not-use-tables-for-layout-in-html – Shomz