使图片库对移动设备有响应?

时间:2015-04-19 21:57:56

标签: css mobile responsive-design

我一直在使我的新网站尽可能快速响应。我得到了我的徽标,通过使用“style = max-width:100%”响应不同的sice屏幕,它完美地运行。但是,当我将它添加到我的图库时,它不起作用。当他们想要彼此相邻的时候,我总是把它们放在下面的图像上。这是我正在使用的HTML;

<div align="center"> 
<section class="slide" style="max-width: 100%">         
<strong> <H2> Featured Work </H2> </strong>

        <div class="stage">
        <a href="#" class="element feature1"><a>
        <a href="#" class="element feature2"><a>
        <a href="#" class="element feature3"><a>
        <a href="#" class="element feature4"><a>


    </section>
    </div>

这是CSS;

.slide {
  max-width: 2000px;
  width: 100%;
  margin: 70px auto 0;
  opacity: 0;
  position: relative;
  -webkit-transition: all 0.25s ease-in-out;
  -moz-transition: all 0.25s ease-in-out;
  -ms-transition: all 0.25s ease-in-out;
  -o-transition: all 0.25s ease-in-out;
  transition: all 0.25s ease-in-out;
  -webkit-animation: 1s appear 1 forwards;
  -moz-animation: 1s appear 1 forwards;
  -o-animation: 1s appear 1 forwards;
  animation: 1s appear 1 forwards;

.element {
  background: green;
  width: 202px;
  -webkit-transform-origin: 50% 50%;
  height: inherit;
  margin: 0 7px 0 0;
  display: inline-block;
  -webkit-transition: all 0.25s ease-in-out;
  -moz-transition: all 0.25s ease-in-out;
  -ms-transition: all 0.25s ease-in-out;
  -o-transition: all 0.25s ease-in-out;
  transition: all 0.25s ease-in-out;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}
.element.active {
  width: 310px;
  -webkit-transition: all 0.25s ease-in-out;
  -moz-transition: all 0.25s ease-in-out;
  -ms-transition: all 0.25s ease-in-out;
  -o-transition: all 0.25s ease-in-out;
  transition: all 0.25s ease-in-out;
}
.element.inactive {
  width: 162px;
  -webkit-transition: all 0.25s ease-in-out;
  -moz-transition: all 0.25s ease-in-out;
  -ms-transition: all 0.25s ease-in-out;
  -o-transition: all 0.25s ease-in-out;
  transition: all 0.25s ease-in-out;
  opacity: 0.4;
}
.element.feature1 {
  background: url('../images/feature1.jpeg') 45% 0 no-repeat;
  max-width: 100%;
  background-size: cover;
}
.element.feature2 {
  background: url('../images/feature2.jpeg') 45% 0 no-repeat;
  max-width: 100%;
  background-size: cover;
}
.element.feature3 {
  background: url('../images/feature3.jpeg') 45% 0 no-repeat;
  max-width: 100%;
  background-size: cover;
}

.element.feature4 {
  background: url('../images/feature3.jpeg') 45% 0 no-repeat;
  max-width: 100%;
  background-size: cover;
}
.element:last-of-type {
  margin: 0;
}

网站为http://www.kingdombrand.com,如果您想查看以获得帮助。我在iPhone 5上看这个网站,所以我猜它会在更大的屏幕上工作,因为它只是稍微偏离我的。

0 个答案:

没有答案