Javascript 中心导航项目引导CSS
我不知道如何使用引导将导航项目居中。我在这里研究了很多帖子,但我还是搞不懂。我已经有好几年没有用HTML和CSS编程了,所以我很生疏。我希望我能很快掌握这个窍门,因为像这样的小事真的让我很烦恼。我尝试了许多不同的方法,尝试了许多不同的简单教程,但我不能确切地知道我需要做什么。救命啊 CSS: HTML:Javascript 中心导航项目引导CSS,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我不知道如何使用引导将导航项目居中。我在这里研究了很多帖子,但我还是搞不懂。我已经有好几年没有用HTML和CSS编程了,所以我很生疏。我希望我能很快掌握这个窍门,因为像这样的小事真的让我很烦恼。我尝试了许多不同的方法,尝试了许多不同的简单教程,但我不能确切地知道我需要做什么。救命啊 CSS: HTML: 德克萨斯州博览会 其他展览 编辑:在index.html页面的顶部找到了这个CSS,我相信这就是我将导航栏项目居中的地方 /* CUSTOMIZE THE NA
-
德克萨斯州博览会
其他展览
编辑:在index.html页面的顶部找到了这个CSS,我相信这就是我将导航栏项目居中的地方
/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */
/* Special class on .container surrounding .navbar, used for positioning it into place. */
.navbar-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
margin-top: 20px;
margin-bottom: -90px; /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
}
.navbar-wrapper .navbar {
}
/* Remove border and change up box shadow for more contrast */
.navbar .navbar-inner {
border: 0;
-webkit-box-shadow: 0 2px 10px rgba(0,0,0,.25);
-moz-box-shadow: 0 2px 10px rgba(0,0,0,.25);
box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
/* Downsize the brand/project name a bit */
.navbar .brand {
padding: 14px 20px 16px; /* Increase vertical padding to match navbar links */
font-size: 16px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}
/* Navbar links: increase padding for taller navbar */
.navbar .nav > li > a {
padding: 15px 20px;
}
/* Offset the responsive button for proper vertical alignment */
.navbar .btn-navbar {
margin-top: 10px;
}
/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
/* Carousel base class */
.carousel {
margin-bottom: 60px;
}
.carousel .container {
position: relative;
z-index: 9;
}
.carousel-control {
height: 80px;
margin-top: 0;
font-size: 120px;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
background-color: transparent;
border: 0;
z-index: 10;
}
.carousel .item {
height: 500px;
}
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
}
.carousel-caption {
background-color: transparent;
position: static;
max-width: 550px;
padding: 0 20px;
margin-top: 200px;
}
.carousel-caption h1,
.carousel-caption .lead {
margin: 0;
line-height: 1.25;
color: #fff;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.carousel-caption .btn {
margin-top: 10px;
}
/* MARKETING CONTENT
-------------------------------------------------- */
/* Center align the text within the three columns below the carousel */
.marketing .span4 {
text-align: center;
}
.marketing h2 {
font-weight: normal;
}
.marketing .span4 p {
margin-left: 10px;
margin-right: 10px;
}
/* Featurettes
------------------------- */
.featurette-divider {
margin: 80px 0; /* Space out the Bootstrap <hr> more */
}
.featurette {
padding-top: 120px; /* Vertically center images part 1: add padding above and below text. */
overflow: hidden; /* Vertically center images part 2: clear their floats. */
}
.featurette-image {
margin-top: -120px; /* Vertically center images part 3: negative margin up the image the same amount of the padding to center it. */
}
/* Give some space on the sides of the floated elements so text doesn't run right into it. */
.featurette-image.pull-left {
margin-right: 40px;
}
.featurette-image.pull-right {
margin-left: 40px;
}
/* Thin out the marketing headings */
.featurette-heading {
font-size: 50px;
font-weight: 300;
line-height: 1;
letter-spacing: -1px;
}
/* RESPONSIVE CSS
-------------------------------------------------- */
@media (max-width: 979px) {
.container.navbar-wrapper {
margin-bottom: 0;
width: auto;
}
.navbar-inner {
border-radius: 0;
margin: -20px 0;
}
.carousel .item {
height: 500px;
}
.carousel img {
width: auto;
height: 500px;
}
.featurette {
height: auto;
padding: 0;
}
.featurette-image.pull-left,
.featurette-image.pull-right {
display: block;
float: none;
max-width: 40%;
margin: 0 auto 20px;
}
}
@media (max-width: 767px) {
.navbar-inner {
margin: -20px;
}
.carousel {
margin-left: -20px;
margin-right: -20px;
}
.carousel .container {
}
.carousel .item {
height: 300px;
}
.carousel img {
height: 300px;
}
.carousel-caption {
width: 65%;
padding: 0 70px;
margin-top: 100px;
}
.carousel-caption h1 {
font-size: 30px;
}
.carousel-caption .lead,
.carousel-caption .btn {
font-size: 18px;
}
.marketing .span4 + .span4 {
margin-top: 40px;
}
.featurette-heading {
font-size: 30px;
}
.featurette .lead {
font-size: 18px;
line-height: 1.5;
}
}
</style>
/*自定义导航栏
-------------------------------------------------- */
/*特殊类别。容器周围。导航栏,用于将其定位到位*/
.导航栏包装{
位置:绝对位置;
排名:0;
左:0;
右:0;
z指数:10;
边缘顶部:20px;
边距底部:-90px;/*向上拉转盘的负边距。90px大致是边距和导航栏的高度*/
}
.navbar包装器.navbar{
}
/*删除边框,并将框阴影向上更改以获得更多对比度*/
.导航栏.导航栏内部{
边界:0;
-webkit盒阴影:0 2px 10px rgba(0,0,0,25);
-moz盒阴影:0 2px 10px rgba(0,0,0,25);
盒影:0 2px 10px rgba(0,0,0,25);
}
/*将品牌/项目名称缩小一点*/
.navbar.brand{
填充:14px 20px 16px;/*增加垂直填充以匹配导航栏链接*/
字体大小:16px;
字体大小:粗体;
文本阴影:0-1px0RGBA(0,0,0,5);
}
/*导航栏链接:增加较高导航栏的填充*/
.navbar.nav>li>a{
填充:15px 20px;
}
/*偏移响应按钮以进行适当的垂直对齐*/
.navbar.btn navbar{
边缘顶部:10px;
}
/*自定义旋转木马
-------------------------------------------------- */
/*旋转木马基类*/
旋转木马{
边缘底部:60px;
}
.传送带.集装箱{
位置:相对位置;
z指数:9;
}
.传送带控制{
高度:80px;
边际上限:0;
字体大小:120px;
文本阴影:0 1px 1px rgba(0,0,0,4);
背景色:透明;
边界:0;
z指数:10;
}
.carousel.项目{
高度:500px;
}
.旋转木马{
位置:绝对位置;
排名:0;
左:0;
最小宽度:100%;
高度:500px;
}
.旋转木马标题{
背景色:透明;
位置:静态;
最大宽度:550px;
填充:0 20px;
利润上限:200px;
}
.旋转木马标题h1,
.旋转木马标题.导语{
保证金:0;
线高:1.25;
颜色:#fff;
文本阴影:0 1px 1px rgba(0,0,0,4);
}
.carousel标题.btn{
边缘顶部:10px;
}
/*营销内容
-------------------------------------------------- */
/*将旋转木马下方三列内的文本居中对齐*/
.市场营销{
文本对齐:居中;
}
.市场推广h2{
字体大小:正常;
}
.市场营销{
左边距:10px;
右边距:10px;
}
/*特写
------------------------- */
.特征分割器{
边距:80px 0;/*留出引导空间
更多*/
}
特辑{
顶部填充:120px;/*垂直居中图像第1部分:在文本上方和下方添加填充*/
溢出:隐藏;/*垂直居中图像第2部分:清除其浮动*/
}
.特色图片{
页边距顶部:-120px;/*垂直居中图像第3部分:负页边距向上使图像居中的填充量相同*/
}
/*在浮动元素的两侧留出一些空间,这样文本就不会直接进入其中*/
.featurette-image.pull-left{
右边距:40px;
}
.featurette-image.pull-right{
左边距:40px;
}
/*精简营销标题*/
.专题标题{
字体大小:50px;
字体大小:300;
线高:1;
字母间距:-1px;
}
/*响应式CSS
-------------------------------------------------- */
@介质(最大宽度:979px){
.container.navbar-wrapper{
页边距底部:0;
宽度:自动;
}
.导航栏内部{
边界半径:0;
利润率:-20px0;
}
.carousel.项目{
高度:500px;
}
.旋转木马{
宽度:自动;
高度:500px;
}
特辑{
高度:自动;
填充:0;
}
.featurette-image.pull-left,
.featurette-image.pull-right{
显示:块;
浮动:无;
最大宽度:40%;
保证金:0自动20px;
}
}
@介质(最大宽度:767px){
.导航栏内部{
利润率:-20px;
}
旋转木马{
左边距:-20px;
右边距:-20px;
}
.传送带.集装箱{
}
.carousel.项目{
高度:300px;
}
旋转木马
<div class="navbar-wrapper">
<!-- Wrap the .navbar in .container to center it within the absolutely positioned parent. -->
<div class="container">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<!-- Responsive Navbar Part 1: Button for triggering responsive navbar (not covered in tutorial). Include responsive CSS to utilize. -->
<button type="button" 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>
</button>
<img class="brand" source="assets/images/logo.jpg"></img>
<!-- Responsive Navbar Part 2: Place all navbar contents you want collapsed withing .navbar-collapse.collapse. -->
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="contact.html">Contact</a></li>
<!-- Read about Bootstrap dropdowns at http://twbs.github.com/bootstrap/javascript.html#dropdowns -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Expos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="nav-header">Texas Expositions</li>
<li><a href="#">Longview</a></li>
<li><a href="#">Houston</a></li>
<li><a href="#">Austin</a></li>
<li><a href="#">Midland</a></li>
<li class="divider"></li>
<li class="nav-header">Other Expositions</li>
<li><a href="#">Louisiana</a></li>
<li><a href="#">Oklahoma</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!-- /.navbar-inner -->
</div><!-- /.navbar -->
</div> <!-- /.container -->
</div><!-- /.navbar-wrapper -->
/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */
/* Special class on .container surrounding .navbar, used for positioning it into place. */
.navbar-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
margin-top: 20px;
margin-bottom: -90px; /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
}
.navbar-wrapper .navbar {
}
/* Remove border and change up box shadow for more contrast */
.navbar .navbar-inner {
border: 0;
-webkit-box-shadow: 0 2px 10px rgba(0,0,0,.25);
-moz-box-shadow: 0 2px 10px rgba(0,0,0,.25);
box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
/* Downsize the brand/project name a bit */
.navbar .brand {
padding: 14px 20px 16px; /* Increase vertical padding to match navbar links */
font-size: 16px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}
/* Navbar links: increase padding for taller navbar */
.navbar .nav > li > a {
padding: 15px 20px;
}
/* Offset the responsive button for proper vertical alignment */
.navbar .btn-navbar {
margin-top: 10px;
}
/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
/* Carousel base class */
.carousel {
margin-bottom: 60px;
}
.carousel .container {
position: relative;
z-index: 9;
}
.carousel-control {
height: 80px;
margin-top: 0;
font-size: 120px;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
background-color: transparent;
border: 0;
z-index: 10;
}
.carousel .item {
height: 500px;
}
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
}
.carousel-caption {
background-color: transparent;
position: static;
max-width: 550px;
padding: 0 20px;
margin-top: 200px;
}
.carousel-caption h1,
.carousel-caption .lead {
margin: 0;
line-height: 1.25;
color: #fff;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.carousel-caption .btn {
margin-top: 10px;
}
/* MARKETING CONTENT
-------------------------------------------------- */
/* Center align the text within the three columns below the carousel */
.marketing .span4 {
text-align: center;
}
.marketing h2 {
font-weight: normal;
}
.marketing .span4 p {
margin-left: 10px;
margin-right: 10px;
}
/* Featurettes
------------------------- */
.featurette-divider {
margin: 80px 0; /* Space out the Bootstrap <hr> more */
}
.featurette {
padding-top: 120px; /* Vertically center images part 1: add padding above and below text. */
overflow: hidden; /* Vertically center images part 2: clear their floats. */
}
.featurette-image {
margin-top: -120px; /* Vertically center images part 3: negative margin up the image the same amount of the padding to center it. */
}
/* Give some space on the sides of the floated elements so text doesn't run right into it. */
.featurette-image.pull-left {
margin-right: 40px;
}
.featurette-image.pull-right {
margin-left: 40px;
}
/* Thin out the marketing headings */
.featurette-heading {
font-size: 50px;
font-weight: 300;
line-height: 1;
letter-spacing: -1px;
}
/* RESPONSIVE CSS
-------------------------------------------------- */
@media (max-width: 979px) {
.container.navbar-wrapper {
margin-bottom: 0;
width: auto;
}
.navbar-inner {
border-radius: 0;
margin: -20px 0;
}
.carousel .item {
height: 500px;
}
.carousel img {
width: auto;
height: 500px;
}
.featurette {
height: auto;
padding: 0;
}
.featurette-image.pull-left,
.featurette-image.pull-right {
display: block;
float: none;
max-width: 40%;
margin: 0 auto 20px;
}
}
@media (max-width: 767px) {
.navbar-inner {
margin: -20px;
}
.carousel {
margin-left: -20px;
margin-right: -20px;
}
.carousel .container {
}
.carousel .item {
height: 300px;
}
.carousel img {
height: 300px;
}
.carousel-caption {
width: 65%;
padding: 0 70px;
margin-top: 100px;
}
.carousel-caption h1 {
font-size: 30px;
}
.carousel-caption .lead,
.carousel-caption .btn {
font-size: 18px;
}
.marketing .span4 + .span4 {
margin-top: 40px;
}
.featurette-heading {
font-size: 30px;
}
.featurette .lead {
font-size: 18px;
line-height: 1.5;
}
}
</style>