2015-07-20 52 views
1

我使用滑塊與相關聯的CSS的權利。滑塊與空白出現在小屏幕

.slider { 
 
    position: relative; 
 
    background: #f6f7f9; 
 
    margin-bottom: 50px; 
 
} 
 
.slider .slides { 
 
    list-style: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    *zoom: 1; 
 
} 
 
.slider .slides:after { 
 
    content: " "; 
 
    clear: both; 
 
    display: block; 
 
    overflow: hidden; 
 
    height: 0; 
 
} 
 
.slider .slides li { 
 
    float: left; 
 
    width: 100%; 
 
margin-right: -100%; 
 
    padding: 30px 0; 
 
} 
 
.slider .slides li img { 
 
    float: right; 
 
} 
 
.slider .slide-caption { 
 
    padding: 70px 50px 30px 0; 
 
} 
 
.slider .slide-title, .slider .slide-subtitle, .slider .slide-summary, .slider .button { 
 
    -webkit-transition: .3s ease-in; 
 
      transition: .3s ease-in; 
 
    opacity: 0; 
 
} 
 
.slider .slide-title { 
 
    color: #152559; 
 
    margin: 0 0 10px; 
 
    font-size: 55px; 
 
    font-size: 2.8375em; 
 
    -webkit-transform: scale(1.5); 
 
     -ms-transform: scale(1.5); 
 
      transform: scale(1.5); 
 
    line-height: 55px; 
 
} 
 
.slider .slide-subtitle { 
 
    color: #01a6d4; 
 
    display: block; 
 
    margin: 0 0 50px; 
 
    font-weight: 300; 
 
    font-size: 36px; 
 
    font-size: 2.25em; 
 
    -webkit-transform: scale(1.5); 
 
     -ms-transform: scale(1.5); 
 
      transform: scale(1.5); 
 
    -webkit-transition-delay: .3s; 
 
      transition-delay: .3s; 
 
} 
 
.slider .slide-summary { 
 
    -webkit-transform: translateX(200px); 
 
     -ms-transform: translateX(200px); 
 
      transform: translateX(200px); 
 
    -webkit-transition-delay: .6s; 
 
      transition-delay: .6s; 
 
    margin-bottom: 50px; 
 
} 
 
.slider .button { 
 
    -webkit-transform: scale(0.3); 
 
     -ms-transform: scale(0.3); 
 
      transform: scale(0.3); 
 
    -webkit-transition-delay: .9s; 
 
      transition-delay: .9s; 
 
} 
 
.slider .flex-active-slide .slide-title, .slider .flex-active-slide .slide-subtitle { 
 
    -webkit-transform: scale(1); 
 
     -ms-transform: scale(1); 
 
      transform: scale(1); 
 
    opacity: 1; 
 
} 
 
.slider .flex-active-slide .slide-summary { 
 
    -webkit-transform: translateX(0); 
 
     -ms-transform: translateX(0); 
 
      transform: translateX(0); 
 
    opacity: 1; 
 
} 
 
.slider .flex-active-slide .button { 
 
    -webkit-transform: scale(1); 
 
     -ms-transform: scale(1); 
 
      transform: scale(1); 
 
    opacity: 1; 
 
} 
 
.slider .flex-control-nav { 
 
    list-style: none; 
 
    text-align: center; 
 
    position: absolute; 
 
    bottom: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    z-index: 9; 
 
} 
 
.slider .flex-control-nav li { 
 
    display: inline-block; 
 
    margin: 0 2px; 
 
} 
 
.slider .flex-control-nav li a { 
 
    width: 10px; 
 
    height: 10px; 
 
    border-radius: 50%; 
 
    background: #cbccce; 
 
    display: block; 
 
    text-indent: -9999px; 
 
    cursor: pointer; 
 
} 
 
.slider .flex-control-nav li a.flex-active { 
 
    background: #01a6d4; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
 
<body> 
 
     <div class="slider"> 
 
      <ul class="slides"> 
 
      <li> 
 
       <div class="container"> 
 
        
 
       <div class="slide-caption"> 
 
        <h2 class="slide-title">Welcome </h2> 
 
        <small class="slide-subtitle">Start Your Own blah blah blah</small> 
 
        <div class="slide-summary"> 
 
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus, illum laborum odit est quibusdam, molestias quaerat qui, eveniet voluptate debitis, earum dolorem. Fuga maxime fugit excepturi, saepe fugiat quisquam quia! 
 
        </p> 
 
        </div> 
 
        <a href="" class="button">Read More</a> 
 
       </div> 
 
       </div> 
 
      </li> 
 
      <li> 
 
       
 
       <div class="slide-caption"> 
 
        <h2 class="slide-title">Blah blah blah blah</h2> 
 
        <small class="slide-subtitle">Blah blah blah blah</small> 
 
        <div class="slide-summary"> 
 
        <p>Perspiciatis quo, aspernatur similique? Cumque quidem ipsa et. Nobis officia error nam veritatis culpa ut ullam maxime in ad hic, earum repudiandae? 
 
        </p> 
 
        </div> 
 
        
 
       </div> 
 
       
 
      </li> 
 
      <li> 
 
        
 
       <div class="slide-caption"> 
 
        <h2 class="slide-title">Easy to Use blah blah blah</h2> 
 
        <small class="slide-subtitle">manage blah blah blah blah blah</small> 
 
        <div class="slide-summary"> 
 
        <p>Sapiente porro, laudantium consectetur doloremque. Explicabo, esse, expedita. Animi dolorum aliquid nihil necessitatibus itaque quis architecto, fuga rerum. 
 
        </p> 
 
        </div> 
 
        
 
       </div> 
 
       
 
      </li> 
 
      </ul> <!-- .slides --> 
 
     </div> <!-- .slider --> 
 
</body>

我使用的是完全成熟的JavaScript版本,其中滑塊的作品,但一直保持它的簡單,因爲保證金的問題似乎在CSS發起。 任何想法,爲什麼我在灰色區域的右側得到一個空格,以及如何刪除它?它不會出現在較大的屏幕上。

回答

1

.slider { 
 
    position: relative; 
 
    background: #f6f7f9; 
 
    margin-bottom: 50px; 
 
} 
 
.slider .slides { 
 
    list-style: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    *zoom: 1; 
 
} 
 
.slider .slides:after { 
 
    content: " "; 
 
    clear: both; 
 
    display: block; 
 
    overflow: hidden; 
 
    height: 0; 
 
} 
 
.slider .slides li { 
 
    float: left; 
 
    width: 100%; 
 
margin-right: -100%; 
 
    padding: 30px 0; 
 
} 
 
.slider .slides li img { 
 
    float: right; 
 
} 
 
.slider .slide-caption { 
 
    padding: 70px 250px 30px 0; 
 
} 
 
.slider .slide-title, .slider .slide-subtitle, .slider .slide-summary, .slider .button { 
 
    -webkit-transition: .3s ease-in; 
 
      transition: .3s ease-in; 
 
    opacity: 0; 
 
} 
 
.slider .slide-title { 
 
    color: #152559; 
 
    margin: 0 0 10px; 
 
    font-size: 55px; 
 
    font-size: 2.8375em; 
 
    -webkit-transform: scale(1.5); 
 
     -ms-transform: scale(1.5); 
 
      transform: scale(1.5); 
 
    line-height: 55px; 
 
} 
 
.slider .slide-subtitle { 
 
    color: #01a6d4; 
 
    display: block; 
 
    margin: 0 0 50px; 
 
    font-weight: 300; 
 
    font-size: 36px; 
 
    font-size: 2.25em; 
 
    -webkit-transform: scale(1.5); 
 
     -ms-transform: scale(1.5); 
 
      transform: scale(1.5); 
 
    -webkit-transition-delay: .3s; 
 
      transition-delay: .3s; 
 
} 
 
.slider .slide-summary { 
 
    -webkit-transform: translateX(200px); 
 
     -ms-transform: translateX(200px); 
 
      transform: translateX(200px); 
 
    -webkit-transition-delay: .6s; 
 
      transition-delay: .6s; 
 
    margin-bottom: 50px; 
 
} 
 
.slider .button { 
 
    -webkit-transform: scale(0.3); 
 
     -ms-transform: scale(0.3); 
 
      transform: scale(0.3); 
 
    -webkit-transition-delay: .9s; 
 
      transition-delay: .9s; 
 
} 
 
.slider .flex-active-slide .slide-title, .slider .flex-active-slide .slide-subtitle { 
 
    -webkit-transform: scale(1); 
 
     -ms-transform: scale(1); 
 
      transform: scale(1); 
 
    opacity: 1; 
 
} 
 
.slider .flex-active-slide .slide-summary { 
 
    -webkit-transform: translateX(0); 
 
     -ms-transform: translateX(0); 
 
      transform: translateX(0); 
 
    opacity: 1; 
 
} 
 
.slider .flex-active-slide .button { 
 
    -webkit-transform: scale(1); 
 
     -ms-transform: scale(1); 
 
      transform: scale(1); 
 
    opacity: 1; 
 
} 
 
.slider .flex-control-nav { 
 
    list-style: none; 
 
    text-align: center; 
 
    position: absolute; 
 
    bottom: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    z-index: 9; 
 
} 
 
.slider .flex-control-nav li { 
 
    display: inline-block; 
 
    margin: 0 2px; 
 
} 
 
.slider .flex-control-nav li a { 
 
    width: 10px; 
 
    height: 10px; 
 
    border-radius: 50%; 
 
    background: #cbccce; 
 
    display: block; 
 
    text-indent: -9999px; 
 
    cursor: pointer; 
 
} 
 
.slider .flex-control-nav li a.flex-active { 
 
    background: #01a6d4; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
 
<body> 
 
     <div class="slider"> 
 
      <ul class="slides"> 
 
      <li> 
 
       <div class="container"> 
 
        
 
       <div class="slide-caption"> 
 
        <h2 class="slide-title">Welcome </h2> 
 
        <small class="slide-subtitle">Start Your Own blah blah blah</small> 
 
        <div class="slide-summary"> 
 
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus, illum laborum odit est quibusdam, molestias quaerat qui, eveniet voluptate debitis, earum dolorem. Fuga maxime fugit excepturi, saepe fugiat quisquam quia! 
 
        </p> 
 
        </div> 
 
        <a href="" class="button">Read More</a> 
 
       </div> 
 
       </div> 
 
      </li> 
 
      <li> 
 
       
 
       <div class="slide-caption"> 
 
        <h2 class="slide-title">Blah blah blah blah</h2> 
 
        <small class="slide-subtitle">Blah blah blah blah</small> 
 
        <div class="slide-summary"> 
 
        <p>Perspiciatis quo, aspernatur similique? Cumque quidem ipsa et. Nobis officia error nam veritatis culpa ut ullam maxime in ad hic, earum repudiandae? 
 
        </p> 
 
        </div> 
 
        
 
       </div> 
 
       
 
      </li> 
 
      <li> 
 
        
 
       <div class="slide-caption"> 
 
        <h2 class="slide-title">Easy to Use blah blah blah</h2> 
 
        <small class="slide-subtitle">manage blah blah blah blah blah</small> 
 
        <div class="slide-summary"> 
 
        <p>Sapiente porro, laudantium consectetur doloremque. Explicabo, esse, expedita. Animi dolorum aliquid nihil necessitatibus itaque quis architecto, fuga rerum. 
 
        </p> 
 
        </div> 
 
        
 
       </div> 
 
       
 
      </li> 
 
      </ul> <!-- .slides --> 
 
     </div> <!-- .slider --> 
 
</body>

+0

謝謝,工作一種享受。 – martyn

+0

你能解釋你的答案嗎?我無法輕易分辨提交的代碼和您的回覆之間的區別。 –

+0

martyn要求清除滑塊邊緣的空格。那段時間滑塊顯示在代碼片段中。但我不知道這是怎麼發生的。當我點擊運行代碼是空的。我調整了.slider .slide-caption {padding:70px 250px 30px 0; } –