【发布时间】:2014-12-11 06:35:44
【问题描述】:
我在父 div 中有两个 div,但是当我检查页面时,这两个 div 不在容器中,即使我已将 div 包裹在其他 2 个 div 周围。
我想将特征添加到父 div,而不是单独添加每个 div。
建议?
<!DOCTYPE html>
<head>
<title>Lavu Explore</title>
<link rel="stylesheet" type="text/css" href="styles_sample.css">
</head>
<body>
<div id="sell_section">
<h2>Sell, Manage, & Market in one easy system</h2>
<hr class="hr_1">
<div class="box1">
<img id ="terminal_img" src="http://i.imgur.com/D5T6lY1.png">
</div>
<div class="box1">
<p style="text-align:left">Choosing a new Point of Sale (POS) is an opportunity. Lavu is not just accepting payments - Lavu is business management on the iPad. Upgrade your business with the Cloud POS system that was developed specifically for the restaurant / hospitality industry. Lavu has the tools you need to improve efficiency and the bottom line. Love your business.</p>
</div>
</div>
</body>
</html>
styles_sample.css
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: auto;
position: relative;
overflow: auto;
padding: 0 5%;
max-width: 990px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
h2 {
text-align: center;
font-family: DIN;
font-size: 40px;
color: #8b8b8b;
text-align: center;
width: 100%;
font-weight: normal;
}
p {
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
color: #8b8b8b;
font-size: 16px;
line-height: 150%;
}
.hr_1 {
position: relative;
padding: 0;
margin: 2% auto;
height: 0;
width: 400px;
max-height: 0;
font-size: 1px;
line-height: 0;
clear: both;
border: none;
border-top: 1px solid #aecd37;
border-bottom: 1px solid #aecd37;
}
.box1 {
width: 50%;
min-width: 50%;
position: relative;
min-height: 1px;
}
@media (min-width: 830px) {
.box1 {
float: left;
}
}
@media (max-width: 830px) {
.box1 {
width: 100%;
}
}
【问题讨论】:
-
他们都在我的父母中。另外,这与您上一个问题stackoverflow.com/questions/27408344/… 有何不同?
-
两个
box1在#sell_section内。有什么问题? -
我对这个网站很陌生,所以由于我没有得到答案,我想我会改写它并缩短问题。
-
最好的建议总是正确地格式化你的代码。这样可以省去很多麻烦。