[英]Bootstrap-Year-Calendar showing all the months Vertically instead of Horizontally
[英]Bootstrap - Collapsed menu items appearing horizontally instead of vertically
出於某種原因,無論我做什么,導航欄都會在折疊時水平顯示菜單項,並且將其徽標放在其中! 當我使用visible-xs etc時,由於某種原因,它將它向左對齊!
我嘗試了在其他類似的溢出問題中找到的方法,例如以內聯塊顯示列表項(盡管不想使用內聯樣式!)
但是沒有任何東西對我有用!
我知道問題是因為在桌面視圖上我的徽標位於菜單項的中央,因此它不是標准菜單,但是必須有一種解決方法,使我的菜單項垂直顯示而中間沒有徽標? 我對此很陌生,所以也許我只是愚蠢而缺少某些東西?
我正在使用jquery mobile(如果有什么區別)(是因為這會中斷菜單並阻止其關閉嗎?)
這是我嘗試過的:
導航欄的HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, no-index">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags must come first in the head; any other head content must come after these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favv.ico">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<script type="text/javascript" src="../node_modules/bootstrap/dist/js/bootstrap.js"></script>
<script src="../assets/js/main.js"></script>
<!-- Custom styles for this template -->
<link href="../node_modules/jquery-mobile/mobilestyles.css" rel="stylesheet">
<link href="/Silver-Lining/css/template.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]>
<!--============ Navigation ===============-->
<nav class="navbar navbar-default navbar-fixed-top text-center">
<nav id="navbar-primary" class="navbar" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<div class="top-social">
<a href="tel:+1-303-499-7111"> <i class="fa fa-phone" aria-hidden="true">
</i> 0787000000
</a>
<a href="#">
<i class="fa fa-facebook-official" aria-hidden="true"></i>
</a>
<a href="#">
<i class="fa fa-twitter-square" aria-hidden="true"></i>
</a>
<a href="#">
<i class="fa fa-instagram" aria-hidden="true"></i>
</a>
<a href="#">
<i class="fa fa-linkedin-square" aria-hidden="true"></i>
</a>
</div>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar-primary-collapse">
<ul class="nav navbar-nav">
<li><a href="about-us.php" data-ajax="false">ABOUT</a></li>
<li><a href="gallery.php" data-ajax="false">OUR CARS</a></li>
<li><a href="Prices.php" data-ajax="false">PRICES</a></li>
<a class="hidden-sm-down" href="index.php" data-ajax="false"><img src="../assets/images/logo" width="250" alt="Logo"></a>
<li><a href="#" data-ajax="false">PACKAGES</a></li>
<li><a href="gallery.php" data-ajax="false">BLOG</a></li>
<li><a href="contact.php" data-ajax="false">CONTACT</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
使菜單項垂直顯示在Collapse上的CSS示例:
@media (max-width: 932px) {
#navbar-primary .navbar-nav li a {
float: none;
position: inherit;
display: inline-block !important;
vertical-align: top;
max-height: 300px;
}
}
導航欄的CSS
// Remove excess borders
.navbar-default {
border-top: none;
border-left: 0;
border-right: none;
margin-top: 0px;
padding-bottom: 10px;
font-family: 'Open Sans Condensed', sans-serif;
margin-bottom: 0;
font-size: 18px;
border-color: transparent;
white-space: normal;
}
.navbar-default .navbar-nav > li {
margin-top: 20px;
}
任何幫助將不勝感激,我一直很困惑,至少堅持了幾天,我真的想保留相同的導航欄而不必重新做一遍
在玩了很多代碼之后,我發現
@media screen and (max-width: 768px) {
#navbar-primary .navbar-nav > li {
display: block;
}
}
給了我想要的結果(折疊時垂直堆疊的菜單項!)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.