我正在使用内置的bootstrap版本2.3.2构建一个joomla模板。问题是,当它出现在平板电脑上时,我有很长的导航栏,它分为两行,我希望它在1200px时崩溃。我正在使用以下代码进行导航。
setlocal
set string=cat rat mat fat
set string=%string:t=p%
CSS如下:
<?php
defined('_JEXEC') or die;
// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');
// Load optional rtl Bootstrap css and Bootstrap bugfixes
JHtmlBootstrap::loadCss($includeMaincss = true);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<jdoc:include type="head" />
<!--[if lt IE 9]>
<script src="<?php echo $this->baseurl ?>/media/jui/js/html5.js"></script>
<![endif]-->
<link href="templates/test/css/template.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<div class="row-fluid">
<div id="logo" class="span12"><a href="home.html"><img src="templates/test/images/logo.png" alt="Home - Freeterm Limited, London"></a></div>
</div>
</div>
<div class="container">
<div class="row-fluid">
<nav class="span12 navbar">
<div class="navbar-inner">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse"><jdoc:include type="modules" name="nav" style="none" /></div>
</div>
</nav>
</div></div>
答案 0 :(得分:1)
只需在您的css文件中添加
@media (max-width: 1000px) {
.navbar-header {
float: none !important;
}
.navbar-default {
background-color: #222 !important;
border-color: transparent;
padding:0px !important;
}
.nav > li {
display: block !important;
position: relative;
}
.navbar-left, .navbar-right {
float: none !important;
}
.navbar-nav > li.navbar-right {
float: none !important;
}
.navbar{
min-height:50px;
position:relative;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block !important;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none !important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none !important;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}