在小提琴下面,有一个分页,当你将盘旋时,一个圆圈会动画起来,但是,在safari中,该圈内的图像不尊重溢出隐藏,在其他浏览器中它的工作正常..
在任何解决方案中,Image都需要垂直居中......
小提琴: -
HTML
<div class="slideContainer vidopia slide-row">
<div class="article_pagination2">
<div class="back_arrow2 arrow-disable"><a title="Prev" href="javascript:void(0);"><strong>Prev</strong></a></div>
<ul>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=1'" class="pagination_no2"><span title="Slide 1" class="pg_number2 active">1</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/players_1428406480.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=2'" class="pagination_no2"><span title="Slide 2" class="pg_number2 ">2</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/dhoni_1428406477.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=3'" class="pagination_no2"><span title="Slide 3" class="pg_number2 ">3</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/bailey_1428406477.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=4'" class="pagination_no2"><span title="Slide 4" class="pg_number2 ">4</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/gautam_1428406478.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=5'" class="pagination_no2"><span title="Slide 5" class="pg_number2 ">5</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/rohit-1_1428406482.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=6'" class="pagination_no2"><span title="Slide 6" class="pg_number2 ">6</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/watson_1428406488.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=7'" class="pagination_no2"><span title="Slide 7" class="pg_number2 ">7</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/virat-1_1428406484.jpg"></span></figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=8'" class="pagination_no2"><span title="Slide 8" class="pg_number2 ">8</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/warner_1428406486.jpg"></span></figure>
</div>
</li>
</ul>
<div class="next_arrow2 "><a title="Next" href="http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=2"><strong>Next</strong></a></div>
</div>
</div>
的CSS
.article_slide2 {
font: 25px/20px impact, Arial, Helvetica, sans-serif;
color: #0065bd;
display: inline-block;
margin-top: 20px;
}
.article_pagination2 {
width: 680px;
display: inline-block;
box-sizing: border-box;
margin: 10px 0;
position: relative;
}
.article_pagination2:after {
content: "";
width: 94%;
height: 2px;
background: #0065bd;
float: left;
position: absolute;
left: 22px;
top: 17px;
z-index: 0;
}
.article_pagination2 ul {
float: none;
margin: 0 auto;
text-align: center;
width: 590px;
font-size: 0px;
}
.article_pagination2 li {
position: relative;
cursor: pointer;
z-index: 2;
margin: 0 4px;
display: inline-block;
}
.article_pagination2 li .pg_number2 {
width: 33px;
line-height: 33px;
text-align: center;
font-size: 14px;
height: 33px;
float: left; /*display:table-cell; */
vertical-align: middle;
color: #fff;
border-radius: 50%;
background: #0065bd;
border: 2px solid #0065bd;
position: relative;
z-index: 2;
transition-duration: 0.2s;
-webkit-transition-duration: 0.2s;
font-family: arial !important;
}
.article_pagination2 li .pg_number2:hover, .article_pagination2 li .pg_number2.active {
background: #FFFFFF;
transform: scale(1.15);
-ms-transform: scale(1.15);
-webkit-transform: scale(1.15);
z-index: 2;
color: #0065BD;
border: 2px solid #0065BD;
font-weight: bold;
font-size: 18px;
}
.article_pagination2 li:hover .article_image2 {
visibility: visible;
opacity: 1;
top: -85px;
top: -82px\9;
}
.article_pagination2 li .article_image2 {
border-radius: 50%;
width: 70px;
height: 70px;
border: 2px solid #0065bd;
display: inline-block;
position: absolute;
top: -40px;
left: -19px;
transition: all .5s ease;
-webkit-transition: all .5s ease;
visibility: hidden;
opacity: 0;
z-index: 1;
margin: 0;
}
.article_pagination2 li .image_inner {
border-radius: 50%;
width: 70px;
height: 70px;
display: block;
overflow: hidden;
background: #fff;
position: relative;
}
.article_pagination2 li .article_image2 img {
bottom: 0;
left: 0;
margin: auto;
position: absolute;
right: 0;
text-align: center;
top: 0;
}
.article_pagination2 li .article_image2:after {
content: "";
width: 0;
height: 0;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-top: 7px solid #0065bd;
font-size: 0;
line-height: 0;
float: right;
position: absolute;
bottom: -8px;
left: 50%;
z-index: 9;
margin-left: -6px;
}
.article_pagination2 .back_arrow2 a, .article_pagination2 .next_arrow2 a {
display: block;
color: #333;
font-family: Arial, Helvetica, sans-serif;
width: 34px;
height: 46px;
border-radius: 50%;
}
.article_pagination2 .back_arrow2 {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2.png) no-repeat #fff;
width: 34px;
height: 34px;
float: left;
overflow: visible;
background-size: 100%;
margin-right: 5px;
position: absolute;
z-index: 2;
left: 0;
top: 0;
}
.article_pagination2 .back_arrow2.arrow-disable {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .next_arrow2 {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2.png) no-repeat #fff;
width: 34px;
height: 34px;
float: right;
overflow: visible;
margin-left: 5px;
background-size: 100%;
position: absolute;
z-index: 2;
right: 0;
top: 0;
}
.article_pagination2 .next_arrow2.arrow-disable {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .arrow-disable a {
cursor: default;
}
.article_pagination2 .next_arrow2 strong, .article_pagination2 .back_arrow2 strong {
position: absolute;
bottom: -15px;
font-size: 12px;
left: 3px
}
.article_pagination2 .arrow-disable strong {
color: #aeaeae;
}
.slideContainer.slide-row {
height: 62px;
padding-bottom: 5px;
margin-bottom: 5px;
}
答案 0 :(得分:1)
这似乎是Safari bug,它似乎不喜欢position: relative;
上的.article_pagination2 li .image_inner
和position: absolute;
上的.article_pagination2 li .article_image2 img
。如果您从这两个选择器中删除position
,问题就会消失。这意味着img
的居中需要以不同的方式处理(因为绝对定位不能使用),所以我添加了一个额外的伪元素display: inline-block;
,height: 100%;
和vertical-align: middle;
允许img
垂直对齐.article_image2
的中心。
position: relative;
.article_pagination2 li .image_inner
.article_pagination2 li .image_inner:after
以允许图像垂直对齐absolute
.article_pagination2 li .article_image2 img
定位相关的所有样式
vertical-align: middle;
添加到.article_pagination2 li .article_image2 img
.slideContainer {
margin-top: 100px;
}
.article_slide2 {
font: 25px/20px impact, Arial, Helvetica, sans-serif;
color: #0065bd;
display: inline-block;
margin-top: 20px;
}
.article_pagination2 {
width: 680px;
display: inline-block;
box-sizing: border-box;
margin: 10px 0;
position: relative;
}
.article_pagination2:after {
content: "";
width: 94%;
height: 2px;
background: #0065bd;
float: left;
position: absolute;
left: 22px;
top: 17px;
z-index: 0;
}
.article_pagination2 ul {
float: none;
margin: 0 auto;
text-align: center;
width: 590px;
font-size: 0px;
}
.article_pagination2 li {
position: relative;
cursor: pointer;
z-index: 2;
margin: 0 4px;
display: inline-block;
}
.article_pagination2 li .pg_number2 {
width: 33px;
line-height: 33px;
text-align: center;
font-size: 14px;
height: 33px;
float: left;
/*display:table-cell; */
vertical-align: middle;
color: #fff;
border-radius: 50%;
background: #0065bd;
border: 2px solid #0065bd;
position: relative;
z-index: 2;
transition-duration: 0.2s;
-webkit-transition-duration: 0.2s;
font-family: arial !important;
}
.article_pagination2 li .pg_number2:hover,
.article_pagination2 li .pg_number2.active {
background: #FFFFFF;
transform: scale(1.15);
-ms-transform: scale(1.15);
-webkit-transform: scale(1.15);
z-index: 2;
color: #0065BD;
border: 2px solid #0065BD;
font-weight: bold;
font-size: 18px;
}
.article_pagination2 li:hover .article_image2 {
visibility: visible;
opacity: 1;
top: -85px;
top: -82px\9;
}
.article_pagination2 li .article_image2 {
border-radius: 50%;
width: 70px;
height: 70px;
border: 2px solid #0065bd;
display: inline-block;
position: absolute;
top: -40px;
left: -19px;
transition: all .5s ease;
-webkit-transition: all .5s ease;
visibility: hidden;
opacity: 0;
z-index: 1;
margin: 0;
}
.article_pagination2 li .image_inner {
border-radius: 50%;
width: 70px;
height: 70px;
display: block;
overflow: hidden;
background: #fff;
/*position: relative; Remove*/
}
/*Add*/
.article_pagination2 li .image_inner:after {
content: "";
display: inline-block;
height: 100%;
vertical-align: middle;
width: 0;
}
.article_pagination2 li .article_image2 img {
/*bottom: 0; Remove*/
/*left: 0; Remove*/
/*margin: auto; Remove*/
/*position: absolute; Remove*/
/*right: 0; Remove*/
text-align: center;
vertical-align: middle; /*Add*/
/*top: 0; Remove*/
}
.article_pagination2 li .article_image2:after {
content: "";
width: 0;
height: 0;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-top: 7px solid #0065bd;
font-size: 0;
line-height: 0;
float: right;
position: absolute;
bottom: -8px;
left: 50%;
z-index: 9;
margin-left: -6px;
}
.article_pagination2 .back_arrow2 a,
.article_pagination2 .next_arrow2 a {
display: block;
color: #333;
font-family: Arial, Helvetica, sans-serif;
width: 34px;
height: 46px;
border-radius: 50%;
}
.article_pagination2 .back_arrow2 {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2.png) no-repeat #fff;
width: 34px;
height: 34px;
float: left;
overflow: visible;
background-size: 100%;
margin-right: 5px;
position: absolute;
z-index: 2;
left: 0;
top: 0;
}
.article_pagination2 .back_arrow2.arrow-disable {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .next_arrow2 {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2.png) no-repeat #fff;
width: 34px;
height: 34px;
float: right;
overflow: visible;
margin-left: 5px;
background-size: 100%;
position: absolute;
z-index: 2;
right: 0;
top: 0;
}
.article_pagination2 .next_arrow2.arrow-disable {
background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .arrow-disable a {
cursor: default;
}
.article_pagination2 .next_arrow2 strong,
.article_pagination2 .back_arrow2 strong {
position: absolute;
bottom: -15px;
font-size: 12px;
left: 3px
}
.article_pagination2 .arrow-disable strong {
color: #aeaeae;
}
.slideContainer.slide-row {
height: 62px;
padding-bottom: 5px;
margin-bottom: 5px;
}
&#13;
<div class="slideContainer vidopia slide-row">
<style>
</style>
<div class="article_pagination2">
<div class="back_arrow2 arrow-disable"><a title="Prev" href="javascript:void(0);"><strong>Prev</strong></a>
</div>
<ul>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=1'" class="pagination_no2"><span title="Slide 1" class="pg_number2 active">1</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/players_1428406480.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=2'" class="pagination_no2"><span title="Slide 2" class="pg_number2 ">2</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/dhoni_1428406477.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=3'" class="pagination_no2"><span title="Slide 3" class="pg_number2 ">3</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/bailey_1428406477.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=4'" class="pagination_no2"><span title="Slide 4" class="pg_number2 ">4</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/gautam_1428406478.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=5'" class="pagination_no2"><span title="Slide 5" class="pg_number2 ">5</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/rohit-1_1428406482.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=6'" class="pagination_no2"><span title="Slide 6" class="pg_number2 ">6</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/watson_1428406488.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=7'" class="pagination_no2"><span title="Slide 7" class="pg_number2 ">7</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/virat-1_1428406484.jpg"></span>
</figure>
</div>
</li>
<li>
<div onclick="location.href='http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=8'" class="pagination_no2"><span title="Slide 8" class="pg_number2 ">8</span>
<figure class="article_image2"><span class="image_inner"><img src="http://i9.dainikbhaskar.com/thumbnail/70x70/web2images/www.bhaskar.com/2015/04/07/warner_1428406486.jpg"></span>
</figure>
</div>
</li>
</ul>
<div class="next_arrow2 "><a title="Next" href="http://www0.bhaskar.com/news-ht/SPO-IPL-OFIPL-introducing-all-the-teams-of-indian-premier-league-8-4957058-PHO.html?seq=2"><strong>Next</strong></a>
</div>
</div>
</div>
&#13;