我期待了解如何定位768px以下的屏幕尺寸,特別是480px的尺寸。我目前正在嘗試創建一個頁面,顯示3個不同網站的3個標誌,這個效果很好,但在達到768px以下時會下降。如何定位Twitter Bootstrap <768px和480px斷點
我的HTML代碼:
<!doctype html>
<html>
<head>
<title>Bootstrap Layout</title>
<link rel="stylesheet" href="custom.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="darkbg col-sm-4 col-xs-12"><img src="logo1.jpg"/></div>
<div class="darkerbg col-sm-4 col-xs-12"><img src="logo2.jpg"/></div>
<div class="darkestbg col-sm-4 col-xs-12"><img src="logo3.jpg"/></div>
</div>
</div>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
我的CSS:
/* custom stylesheet */
.darkbg {
background: #999;
text-align:center;
}
.darkbg img,
.darkerbg img,
.darkestbg img {
width:100%;
}
.darkerbg {
background: #666;
text-align:center;
}
.darkestbg {
background: #333;
text-align:center;
}
當我使用類 「COL-XS-12」 的標誌顯得過於大屏幕上的問題在於和這應該與col-sm相似,並分佈在4列col-xs-4上。這解決了這個問題,但是當我到達480px的斷點時,那麼標誌看起來太小了,據我所知,最低斷點是col-xs,其目標是768px的屏幕尺寸,所以我不知道我能如何解決這個問題問題。
據我所知,我可以使用媒體查詢,但稍微混淆了我需要寫什麼代碼來顯示每個徽標在彼此頂部達到480px的大小。
如果有人可以請指教,真的很感激它。
感謝範伯倫,例子1出色地工作,只是我想要的方式。順便說一句,讓所有圖像與頁面高度垂直對齊以便它位於中心的最佳方式是什麼?只是爲了我的學習,所以會熱衷學習。 –
很高興它爲你工作,並看到關於居中的額外答案。 – vanburen
再次感謝vanburen,非常感謝。 –