我有一些大的背景照片,我不想在較小的屏幕,手機等顯示。我想顯示顏色定義爲背景顏色。隱藏在較小的屏幕上的背景圖像
的代碼是
#search_container1 {
position: relative;
height: 500px;
background: #4d536d url(../img/slide_hero.jpg) no-repeat center top;
background-size: cover;
color:#fff;
width: 100%;
display:table;
z-index:99;
我已經試過
@media (max-width: 768px) {
#search_container1 {
background-image: none !important;
}
}
,但沒有工作。
如何才能簡單的方法?
'#search_container1'是不一樣的'#search'。這可能是一個錯字嗎?另外,我認爲在試圖不加載大圖像時,建議使用'min-width'媒體查詢,否則圖像仍會加載。儘管如此,也許這不是真的。 –
@JosephMarikle是啊他們有什麼工作正常,如果他們修復選擇器https://codepen.io/anon/pen/oWpjrE –