我有一个带有ID #portfolioGallery的Div,在Div里面有一个带有.item类的花药Div - 现在在.item的Div里面有一个图像和花药Div包含信息...所以基本上我正在建立一个画廊 - 看看这里:www.loaistudio.com并滚动到投资组合部分并尝试将鼠标悬停在图像上...
它适用于Chrome的各个方面!当你在Chrome浏览器中移动图像时,它会开始跳跃 - 我做错了什么?即使溢出被隐藏,图像也会因为某种原因而溢出Div .item ....
这是HTML和CSS:
<head>
<meta charset="utf-8" />
<meta name="viewport" id="viewport" content="width=device-width, minimum-scale=1.0, user-scalable=0, maximum-scale=10.0, initial-scale=1.0" />
<link rel="shortcut icon" href="assets/elements/favicon.ico">
<link rel="stylesheet" type="text/css" href="assets/css/reset.css">
<link rel="stylesheet" type="text/css" href="assets/css/core.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width : 1030px)" href="assets/css/tablets-landscape.css"/>
<link rel="stylesheet" type="text/css" media="screen and (max-width : 770px)" href="assets/css/tablets-portrait.css"/>
<link rel="stylesheet" type="text/css" media="screen and (max-width : 500px)" href="assets/css/phone.css"/>
<!--Libraries-->
<script type="text/javascript" src="assets/libraries/jquery.js"></script>
</head>
<body>
<header><!--Header-->
<div id="headerWrapper">
<div id="headerContent">
<div id="headerLogo">
<a href="index.php"><img alt="Logo" src="assets/elements/logo.png"/></a>
</div>
<nav><ul id="mainMenu"><!--Main Menu-->
<li><a href="#Welcome" id="welcome">Home</a></li>
<li><a href="#About" id="about">About us</a></li>
<li><a href="#Portfolio" id="portfolio">Portfolio</a></li>
<li><a href="#Endorsements" id="endorsements">Endorsements</a></li>
<li><a href="#Contact" id="contact">Contact us</a></li>
</ul></nav>
</div>
</div>
</header>
<div id="page"><!--Website Content-->
<div id="secondHeader">
<a class="secondHeader-menuButton" href="#">Menu</a>
<p id="logo-smallScreen">Spacehopper Design</p>
</div>
<div id="Welcome" class="wrapperA"><!--Page Content-->
<div id="home-sectionA" class="content" >
<img src="assets/elements/home-sectionA-background.png">
</div>
</div>
<div id="About" class="wrapperB"><!--Page Content-->
<div id="home-sectionB" class="content" >
<img class="replace1" src="assets/elements/home-sectionB-background.png">
<img class="replace2" src="assets/elements/home-sectionB-background2.png">
<div id="home-sectionB-textbox1">
<h3>..</h3><br>
<p>We strongly believe that everything begins with an idea, and that there is a big idea hidden in all of us.</p>
<p>You may have that Eureka moment, but are unsure how to develop this idea further from an upbeat, design perspective.</p>
<p>This is where Spacehopper Design can help. We are a fast, focused and forward-thinking conceptual agency who promise to find an intuitive solution to your design needs. And of course, we’ll have fun doing so.</p>
<p>With our wealth of experience in editorial design, print design and branding, we also have a deep knowledge of understanding our target audience requirements, from conceptual stage right through to the final product.</p>
<p>So make that leap and let’s work together on making your idea a visual treat and a reality!</p>
</div>
</div>
</div>
<div id="Portfolio" class="wrapperA custom"><!--Page Content-->
<div id="home-sectionC" class="content" >
<img class="replace1" src="assets/elements/home-sectionC-background.png">
<h1 class="replace2">Check out our Work!</h1>
<div id="portfolioGallery">
<div class="item">
<img alt="" src="assets/images/audiobullys.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
<div class="item">
<img alt="" src="assets/images/audiobullys.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
<div class="item">
<img alt="" src="assets/images/audiobullys.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
<div class="item">
<img alt="" src="assets/images/audiobullys.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
<div class="item">
<img alt="" src="assets/images/nta2.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
<div class="item">
<img alt="" src="assets/images/look.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
<div class="item">
<img alt="" src="assets/images/open-bookheat.jpg">
<div>
<h3>Title</h3>
<p>Disruption Disruption Disruption</p>
</div>
</div>
</div>
</div>
</div>
<div id="Endorsements" class="wrapperB"><!--Page Content-->
<div id="home-sectionD" class="content" >
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<div class="home-sectionD-textbox">
<h3>Reesa Amadeo Wolf: Entrepreneur MD at Fresh Young Media </h3>
<p>We knew Srt of the bigger vision for what we do assion for what we do assion for what we do assion for what weas a social enterprise. We will be working with Spacehopper Design for a long time!</p>
</div>
<img src="assets/elements/home-sectionD-background.png">
</div>
</div>
<div id="Contact" class="contactSectionWrapper"><!--Page Content-->
<div id="contactSection" class="content" >
<h2>Want to Get in Touch?</h2>
<div id="grid1">
<form id="contactForm" action="email.php" method="post">
<label for="name">Your Name</label>
<input class="input" id="name" type="text" required placeholder="Enter Name">
<label for="email">Email Address</label>
<input class="input" id="email" type="email" required placeholder="Enter Email">
<label for="message">Message</label>
<textarea class="input" id="message" required></textarea>
<button id="submit" type="submit">Send</button>
</form>
<div id="contact-info">
<p><strong>Email:</strong> Support@LoaiDesign.co.uk</p>
<p><strong>Telephone:</strong> +44 0 745326 2993</p>
<p><strong>Skype:</strong> Loai.Bassam</p>
</div>
<br>
<div class="socialbar icons">
<a href="https://www.facebook.com/LOAI.Design.Studio" class="facebook" target="_blank"><span>Facebook</span></a>
<a href="https://twitter.com/LoaiBassam" class="twitter" target="_blank"><span>Twitter</span></a>
<a href="http://uk.linkedin.com/in/loaibassam" class="linkedin" target="_blank"><span>Linkedin</span></a>
</div>
</div>
<div id="grid2">
<img alt="" src="assets/elements/map.png" id="map">
</div>
</div>
</div>
<footer id="footer"><!--Footer Section-->
<div id="footerContent">
<p>Copyright ©2013 Spacehopper Design. All rights reserved.</p><a href="http://www.loaidesign.co.uk" target="_blank"style="padding-top: 20px;">Website Designed By<img style="display: inline-block; margin-left: 5px; vertical-align: middle;" alt="loai design studio responsive website design" src="assets/elements/loaidesignstudio-logo.png"></a>
</div>
</footer>
</div><!--The End Of The Page-->
<!--Scripts Links-->
<script type="text/javascript" src="assets/js/slider.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
<script src="assets/libraries/modernizr.js"></script>
<script>var snapper = new Snap({
</body>
body {
background-color: #FFFFFF;
line-height: 125%;
text-align: center;
overflow-x: hidden;
-webkit-text-size-adjust: none;
-webkit-overflow-scrolling: touch;
}
/*Font Face*/
@font-face { font-family: Comfortaa; src: url('Comfortaa-Light.ttf'); }
@font-face { font-family: Comfortaa; font-weight: bold; src: url('Comfortaa-Bold.ttf');}
/*Fonts*/h1, h2, h3, h4, h5, h6, p, pre, a, ol, li, span, label, blockquote, figcaption, abbr, td, input, textarea {
font-family: Comfortaa, sans-serif;
font-size: 15px;
color: #636363;
}
h1 {
color: #FFFFFF;
font-size: 26px;
line-height: 120%;
font-weight: bold;
}
h2 {
font-size: 26px;
line-height: 120%;
font-weight: bold;
}
h3 {
font-size: 20px;
font-weight: bold;
}
small {
font-size: 13px;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
img {
display: block;
}
/*MAIN/////////////////////////////////////////////////////////////////////*/
/*Main Page*/#page {
width: 100%;
position: relative;
padding-top: 103px;
overflow: hidden;
}
/*Wrappers*/.wrapper, .wrapperA, .wrapperB, .contactSectionWrapper { width: 100%; overflow: hidden; }
.wrapper {
background-color: #FFFFFF;
}
.wrapperA {
background-color: #F58221;
}
.wrapperB {
background-color: #23408E;
}
/*Content Container*/.content {
width: 1030px;
padding: 0 20px;
margin: auto;
overflow: hidden;
}
/*HEADER///////////////////////////////////////////////////////////////////*/
/*Header Wrapper*/#headerWrapper {
background-color: #ffffff;
width: 100%;
position: fixed;
top: 0; left: 0;
z-index: 1000;
-webkit-box-shadow: 0px 0px 25px -1px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 0px 25px -1px rgba(0,0,0,0.3);
box-shadow: 0px 0px 25px -1px rgba(0,0,0,0.3);
}
/*Header Content Container*/#headerContent {
width: 1030px;
padding: 10px 20px;
margin: auto;
}
/*Header Logo*/#headerLogo {
width: 300px;
float: left;
}
/*Main Menu*/#mainMenu {
margin-top: 20px;
float: right;
}
#mainMenu li {
float: left;
}
#mainMenu a {
color: #F58221;
padding: 10px 15px;
margin-left: 5px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-webkit-transition: background 0.1s linear;
-moz-transition: background 0.1s linear;
-ms-transition: background 0.1s linear;
-o-transition: background 0.1s linear;
transition: background 0.1s linear;
}
#mainMenu a:hover {
color: #23408E;
}
#mainMenu a.active {
color: #ffffff;
background-color: #23408E;
cursor: default;
}
/*Tablet & Phone Header (Hidden From Widescreen's)*/
.secondHeader-menuButton, #secondHeader, #logo-smallScreen {
display: none;
}
/*FOOTER////////////////////////////////////////////////////////////////////*/
/*Footer Section*/
#footer {
border-top: 1px solid #192E66;
background-color: #23408E;
width: 100%;
}
#footerContent {
width: 1030px;
padding: 20px;
margin: auto;
overflow: hidden;
}
#footerContent * {
color: #FFFFFF;
font-size: 13px;
}
/*Replacement Content////////////////////////////////////////////////////////*/
.replace2 {
display: none;
}
/*PAGES////////////////////////////////////////////////////////////////////*/
/*About Page*/
#home-sectionB {
position: relative;
}
#home-sectionB-textbox1 {
width: 500px;
max-width: 100%;
position: absolute;
bottom: 135px;
right: 50px;
text-align: justify;
}
#home-sectionB-textbox1 p, h3 {
color: #FFFFFF;
}
/*Portfolio Page*/
.custom {
background-image: url('../elements/bites.png');
background-repeat: no-repeat;
background-position: right bottom;
}
#home-sectionC {
padding-bottom: 50px;
}
#portfolioGallery * {
color: #FFFFFF;
}
#portfolioGallery .item {
border: 1px dashed #FFFFFF;
width: 310px; height: 250px;
display: inline-block;
margin: 5px;
overflow: hidden;
cursor: pointer;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#portfolioGallery .item div {
background-color: #23408E;
width: 100%; height: 100%;
padding: 100px 20px 20px 20px;
}
#portfolioGallery .item img {
max-width: 380px;
}
#portfolioGallery .item:hover > img {
display: none;
}
/*Endorsements*/
#home-sectionD {
padding-top: 50px;
}
.home-sectionD-textbox * {
color: #FFFFFF;
}
.home-sectionD-textbox {
padding: 30px;
text-align: left;
clear: both;
}
.home-sectionD-textbox:last-of-type {
padding: 30px 30px 0 30px;
}
.home-sectionD-textbox:before {
content: url('../elements/quote.png');
padding-right: 20px;
float: left;
}
/*Contact Page*/
.contactSectionWrapper {
background-color: #FFFFFF;
background-image: url('../elements/strip.png');
background-repeat: repeat-x;
background-position: top;
padding: 50px 0;
}
#contactSection h2 {
color: #F58221;
padding-top: 50px;
font-size: 5em;
}
#grid1 {
width: 40%;
vertical-align: middle;
display: inline-block;
margin-left: -2px;
padding: 50px 0;
}
#grid2 {
width: 60%;
vertical-align: middle;
display: inline-block;
margin-left: -2px;
padding: 0 0 0 50px;
}
#contactForm label{
color: #23408E;
display: block;
padding: 10px 0;
text-align: left;
}
#contactForm input,
#contactForm textarea {
width: 100%;
display: block;
padding: 10px 10px;
margin-bottom: 15px;
text-align: left;
outline: none;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#contactForm textarea{
resize: vertical;
}
#submit{
color: #FFFFFF;
background: #23408E;
border: none;
width: 100%;
padding: 10px 10px;
cursor: pointer;
font-size: 15px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#submit:hover,
#submit:active {
background: #F58221;
}
.notSelected {
color: #B2B2B2;
border: 1px solid #23408E;
}
.selected {
color: #F58221;
border: 1px solid #F58221;
}
#contact-info {
padding-top: 40px;
}
/*Social Media Icons*/
.socialbar {
padding-top: 5px;
display: inline-block;
cursor: default;
}
.icons a {
background-image:url("../elements/socialmediaicons.png");
background-repeat: no-repeat;
display: inline-block;
height: 40px;
width: 40px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.icons a span {
display: none;
}
.icons a.facebook { background-position: 0 -160px; }
.icons a.facebook:hover { background-position: 0 -200px; }
.icons a.linkedin { background-position: 0 -720px; }
.icons a.linkedin:hover { background-position: 0 -760px; }
.icons a.twitter { background-position: 0 -1520px; }
.icons a.twitter:hover { background-position: 0 -1560px; }
答案 0 :(得分:0)
您的.item
元素为display: inline-block
,但您的.item img
元素为display: block
。
因此,当您悬停时,您会在display: block
和inline-block
元素之间切换,并且这两种显示类型在垂直轴上的中心位置不同。
尝试使用CSS规则确保图像始终为inline-block
,例如
#portfolioGallery .item img { display: inline-block; }