我对这个问题有意见。
当我缩小窗口的宽度时,我试着使所有带div的形状保持居中,但是它们总是互相跟随,而且是真正的向左(想想float:left does)。
图像,如果可能的话,我们会保持对我的兴趣,但我已经试图控制宽度百分比,没有工作。
谢谢你的支持。
Fiddler
<div class="general-box">
<div class="left-right-padding">
<ul>
<li class="general-box-title">TITLE 1</li>
<li> <a id="" href="" title=""><img src="" width="156" height="75" alt="" /></a>
<a class="left-margin-photo" href="" title=""><img src="" width="101" height="75" alt="" /></a>
</li>
</ul>
</div>
<div class="left-right-padding">
<ul>
<li class="general-box-title">TITLE 2
<li> <a href="" title=""><img src="" width="92" height="75" alt="" /></a>
<a class="left-margin-photo" href="" title=""><img src="" width="160" height="75" alt="" /></a>
</li>
</ul>
</div>
<div class="left-right-padding">
<ul>
<li class="general-box-title">TITLE 3
<li> <a href="" title=""><img src="" width="170" height="75" alt="" /></a>
<a class="left-margin-photo" href="" title=""><img src="" width="88" height="75" alt="" /></a>
</li>
</ul>
</div>
<div class="clear"></div>
</div>
CSS:
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
outline: none;
text-decoration: none;
zoom: 1;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.clear {
clear: both
}
.general-box {
padding: 0 40px 30px 40px;
font-weight: bold;
border: 1px solid #000;
}
.general-box .left-right-padding {
float: left;
padding: 0 20px 0 20px;
}
.general-box .general-box-title {
margin: 30px 0 30px 0;
}
.general-box .left-margin-photo {
margin-left: 16px;
}
最佳答案
取下浮子,放入
.general-box {
padding: 0 40px 30px 40px;
font-weight: bold;
display: table-row;
border: 1px solid #000;
}
.general-box .left-right-padding {
display: table-cell;
padding: 0 20px 0 20px;
}
在内容周围添加一个div,css:display:table和width:100%
Fiddler