【发布时间】:2013-07-16 04:01:55
【问题描述】:
我在 jsfiddle 中抛出了一个简单的示例来向您展示正在发生的事情,然后我将解释我想要实现的目标..
(代码 html - 在 jsfiddle 中)
<html>
<head>
</head>
<body>
<div class="box1top">
</div>
<div class="box1middle">
<p> Test </p><br />
<p> Test </p>
</div>
<div class="box1bottom">
</div>
<div class="box1top">
</div>
<div class="box1middle">
<p> Test </p><br />
<p> Test </p>
</div>
<div class="box1bottom">
</div>
</body>
</html>
(代码 css - 在 jsfiddle 中)
.box1top {
width: 150px;
height:30px;
background-color:#373737;
margin-left:10px;
margin-right:10px;
margin-top:10px;
}
.box1middle {
width: 150px;
height:200px;
background-color:#676767;
margin-left:10px;
margin-right:10px;
}
.box1bottom {
width: 150px;
height:10px;
background-color:#373737;
margin-left:10px;
margin-right:10px;
}
.box2top {
width: 150px;
height:30px;
background-color:#373737;
margin-left:10px;
margin-right:10px;
}
.box2middle {
width: 150px;
height:200px;
background-color:#676767;
margin-left:10px;
margin-right:10px;
}
.box2bottom {
width: 150px;
height:10px;
background-color:#373737;
margin-left:10px;
margin-right:10px;
}
在上面的示例中,背景颜色将是包含文本的框的图像(分为 3 个图像)
但是我想在浏览器窗口中并排显示这些,而不是在另一个下方显示。我尝试过浮动元素等,但我似乎无法做到这一点?
有人有什么想法吗?任何帮助表示赞赏
谢谢, 卡洛斯
【问题讨论】:
-
你试过
display:inline或display:table-cell吗? -
这是您要找的吗? jsfiddle.net/4UMLq/21
标签: css image positioning