嘿伙计们,我正在通过我构建的 jquery slider 设置内容主体的样式......我的问题是我需要一些图片具有 float: left
以便它们与每个图片对齐其他但父级有一个 margin: -6em 0 0 0;
如果我添加 float:left
它会离开父级 div ......HTML :
<div id="Content">
<div class="main_Body">
<div class="top-halfCont">
<div class="online_training">
<div class="training_image">
<img src="images/onlinetraining_home_03.png" width="75" height="75" />
</div><!-- .training_image -->
</div><!-- .online_training -->
<div class="background_check">
<div class="background_image">
<img src="images/background_check_home_03.png" width="75" height="75" />
</div><!-- .background_image -->
</div><!-- .background_check -->
<div class="uninsured_alert">
<div class="uninsured_alert_image">
<img src="images/unisuredalert_system_03.png" width="75" height="75" />
</div><!-- .uninsured_alert_image -->
</div><!-- .uninsured_alert -->
</div><!-- .top-halfCont -->
</div><!-- .main_Body -->
</div><!-- #Content -->
风格:
/* main content #Content */
#Content {
display:block;
max-width:1200px;
margin:0 auto;
background: white;
position: relative;
box-shadow: 5px 0px 13px #888888;
}
.main_Body {
display:block;
margin: -6em 0 0 0;
padding: 1em;
}
.online_training {
display:block;
width:200px;
}
.training_image {
width:75px;
height:75px;
margin:0 auto;
}
.background_check {
display:block;
width:200px;
}
.background_image {
width:75px;
height:75px;
margin:0 auto;
}
.uninsured_alert {
display:block;
width:200px;
}
.uninsured_alert_image {
width:75px;
height:75px;
margin:0 auto;
}
包括以下变化
.top-halfCont{
margin:6em 0 0 0;
}
.main_Body {
display:block;
margin: -6em 0 0 0;
padding: 1em;
overflow:auto;
}
我是一名优秀的程序员,十分优秀!