2017-09-04 33 views
0

我想隱藏移動和桌面視圖中的圖像,並將鼠標懸停在桌面上的圖像上,並且無法在移動設備上懸停。我使用Bootstrap 4類,但它不工作。我的代碼是否正確?爲什麼我的圖像不能隱藏在引導程序中4隱藏類

<!--start of code--> 

<div class="container-fluid"> 

    <div class="row no-padding"> 
    <div class="col align-self-center hero"> 

     <!--image start--> 
     <div class="row no-padding no-gutters"> 
     <!--display md,lg,xl desktop--> 
     <div class="col-md-12 col-lg-12 col-xl-12 .d-none .d-md-block "> <img class="hidden-sm-down imghover img-fluid" src="images/hero.jpg" alt="The Semiotics hero"></div> 

     <!--display xs, sm mobile/tablets --> 
     <div class="col-xs-12 col-sm-12 .d-md-none "><img class="hidden-md-up imghover img-fluid" src="images/hero-mb.jpg" alt="The Semiotics hero"></div> 
     </div> 
     <!--image end--> 

     <div class="hovertext"> 
     <!--display lg,xl desktop--> 
     <div class="col .d-none .d-lg-block align-self-center"> 
      <h5 class="text-center"> ILLUSTRATION </h5> 
      <h1 class="text-center"> darwin </h1> 
      <h4 class="text-center"> July 14, 2017 </h4> 
      <div class="explore-button text-center"> 

      <button type="button" class="btn btn-default">EXPLORE<span class="icon-right"></span><span class="icon-right after"></span></button> 

      </div> 
     </div> 

     </div> 
    </div> 

    </div> 
</div> 

回答

2

自舉4(測試版)does not have類等hidden-md-up。 (Alpha version had it though.)可以使用Display utilities像這樣:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> 
 

 
<div class="d-none d-md-block">shown only on md and up</div> 
 
<div class="d-md-none">hidden on md and up</div>

編輯:哦,我看到你在你的代碼有這些類似:

<div class="col .d-none .d-lg-block align-self-center"> 

你不需要點(.)那裏,只寫:

<div class="col d-none d-lg-block align-self-center">