0

在我的笔记本电脑上检查我的响应式网站时,它使用百分比很好地缩放,但是当我在我的 iPhone 上检查它时,它为我的垂直图像行增加了一个巨大的上边距。任何想法为什么?该网站在这里http://edharrisondesign.com/pocketpictograms/

提前致谢!

的HTML:

    <!-- Pocket
================================================== -->

    <figure>
        <div class="main-pocket"><img src="images/assets/pocket.png"></div>
        <div class="padding"></div>
    </figure>

<!-- Icons
================================================== -->

    <div class="inside-pocket">
        <div class="icon-container">
            <img class="pictogram" src="images/pocket-pics/pencil.png"> 
            <img class="pictogram" src="images/pocket-pics/iphone.png"> 
            <img class="pictogram" src="images/pocket-pics/earphones.png">  
            <img class="pictogram" src="images/pocket-pics/camera.png"> 
            <img class="pictogram" src="images/pocket-pics/film.png">   
            <img class="pictogram" src="images/pocket-pics/scalpol.png">    
            <img class="pictogram" src="images/pocket-pics/paintbrush.png"> 
            <img class="pictogram" src="images/pocket-pics/fineliner1.png"> 
            <img class="pictogram" src="images/pocket-pics/fineliner2.png"> 
            <img class="pictogram" src="images/pocket-pics/notepad.png">    
            <img class="pictogram" src="images/pocket-pics/mouse.png">  
            <img class="pictogram" src="images/pocket-pics/glasses.png">    
            <img class="pictogram" src="images/pocket-pics/lighter.png">    
            <img class="pictogram" src="images/pocket-pics/pipe.png">   
            <img class="pictogram" src="images/pocket-pics/flask.png">  
            <img class="pictogram" src="images/pocket-pics/matches.png">    
            <img class="pictogram" src="images/pocket-pics/watch.png">  
            <img class="pictogram" src="images/pocket-pics/pocket-watch.png">   
            <img class="pictogram" src="images/pocket-pics/key.png">    
            <img class="pictogram" src="images/pocket-pics/car-key.png">    
        </div>             
    </div>

CSS:

figure {
    z-index: 97;
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
    top: 40%;
    text-align: center;
}  

.padding {
  z-index: 95;
  position:  relative;
  background-color: #D2D2D2;
  height: 100%;
  width: 100%;
  top: -50px;
  overflow: hidden;
  border-bottom: 50px solid #D2D2D2;
}    

.main-pocket img {
   z-index: 96;
   position: relative;
   width: 30%;
   height: auto;
   margin: 0 auto;
   max-width: 300px;
} 

 .inside-pocket {
   width: 100%;
   height: 100%;
   position: absolute;
   margin: 0 auto;
   text-align: center;
 }

 .icon-container {
    position: relative;
    max-width: 300px;
    width: 30%;
    top: 37%;
    margin: 0 auto;
}

.pictogram {
    height: auto;
    width: 100%;
    margin-bottom: 200%;
}
4

1 回答 1

0

好的,我知道我哪里出错了——我应该将上边距设置为 .inside-pocket 类而不是 .icon-container 类。标记在这里:

/* #Pocket
================================================== */
figure {
z-index: 97;
position: fixed;
overflow: hidden;
width: 100%;
height: 100%;
top: 40%;
text-align: center;
}  

.padding {
z-index: 95;
position:  relative;
background-color: #D2D2D2;
height: 100%;
width: 100%;
top: -50px;
overflow: hidden;
border-bottom: 50px solid #D2D2D2;
}    

.main-pocket img {
z-index: 96;
position: relative;
width: 30%;
height: auto;
margin: 0 auto;
max-width: 300px;
} 

.inside-pocket {
width: 100%;
height: 100%;
top: 37%;
position: absolute;
margin: 0 auto;
text-align: center;
}

.icon-container {
position: relative;
max-width: 300px;
width: 30%;
margin: 0 auto;
}

.pictogram {
height: auto;
width: 100%;
margin-bottom: 200%;
}

如果有人能让我知道为什么这是正确的,那就太好了!干杯

于 2013-03-14T22:13:57.777 回答