2017-09-23 87 views

回答

1

在審查了網站之後,而不是將寬度設置爲100%,並將高度設置爲自動,但最好做相反的概念,以下是進行所需更改的CSS!

CSS屬性text-align: center;應該被設置爲ID carousel-modal-demo

#carousel-modal-demo{ 
    text-align: center !important; 
} 

轉盤內類需要如下所示進行修改!

.carousel-inner { 
    position: relative !important; 
    overflow: hidden !important; 
    display: inline-block !important; 
} 

旋轉木馬CSS下的圖像需要像這樣修改。

#carousel-modal-demo img{ 
    width: auto !important; 
    height: 400px !important; 
} 

id #modal頂部應該有50px的填充。

#modal{ 
    padding-top:50px !important; 
} 

所以總CSS的變化是:

#carousel-modal-demo{ 
    text-align: center !important; 
} 

.carousel-inner { 
    position: relative !important; 
    overflow: hidden !important; 
    display: inline-block !important; 
} 

#carousel-modal-demo img{ 
    width: auto !important; 
    height: 400px !important; 
} 

#modal{ 
    padding-top:50px !important; 
} 

它,因爲你設置的CSS屬性max-width:100%的轉盤中的所有圖像。如果使用下面的CSS類將其設置爲width:100%

#carousel-modal-demo div.item > img { 
    width: 100% !important; 
} 

被重寫的類是下面的類。

.carousel-inner>.item>a>img, .carousel-inner>.item>img, .img-responsive, .thumbnail a>img, .thumbnail>img { 
    display: block; 
    max-width: 100%; 
    height: auto; 
} 
+1

非常感謝! :) – ExrowGe

+1

@ExrowGe不客氣! –

+0

我還有一個小問題。如果圖像位於右側,則箭頭和圖像之間會有間隙。我正在添加屏幕截圖> https://gyazo.com/c79956918083dabc018d006870ef98df – ExrowGe