继我以前的问题 ,我有一个代码来显示两行8盒。 该代码完全在Firefox和Chrome,但不是在Safari!
Firefox的输出
Safari浏览器的输出
我不知道是什么原因,可能是。
演示
码
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
}
.itemClass {
width: 100%;
margin: 0 0 1em 0;
box-shadow: 0px 0px 1px 1px black;
background: white;
display: flex;
}
.boxes {
list-style: none;
display: flex;
flex-wrap: wrap;
max-width: 1900px;
width: 100%;
margin: 0 auto;
padding: 1em;
}
.boxesheader {
margin: 0 auto -35px;
max-width: 1900px;
padding: 1em 0;
width: 100%;
}
.itemClass>img {
height: 74px;
width: 120px;
margin: 0 5px 0 0;
}
.itemClass>span {
width: calc(100% - 55px);
margin-left: 2%;
}
@media ( min-width :599px) {
.itemClass {
width: 49%;
margin: 0 2% 1em 0;
}
}
@media ( min-width :599px) and (max-width:1024px) {
.itemClass:nth-child(2n + 2) {
margin: 0 0 1em 0;
}
}
@media ( min-width :1024px) {
.itemClass {
width: 24%;
margin: 0 1.3333333333% 1em 0;
}
.itemClass:nth-child(4n + 4) {
margin: 0 0 1em 0;
}
}
</style>
</head>
<body>
<ul class="boxes">
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
<li class="itemClass"><span class="content"> <strong>Adv1</strong> <br /> <a href="#"
>XXXXXXXXXX</a>
<p>PPPPPPPP pppppp pppppp</p>
<p>fdfgd dfg dfgd fgda fdaf adf sdfsda fdaf df dfd fdsf sdf ds.</p>
</span> <img
src="http://www.google.com/images/srpr/logo11w.png"/></li>
</ul>
</body>
</html>