将导航 div 与响应式幻灯片的边缘对齐
Align navigation div with edge of responsive slideshow
目标是让上方导航 (navbar-right) 的右边缘与下方图片幻灯片的右边缘对齐,就像地址文本现在所做的那样,而不会超出幻灯片的右边缘。
问题在于地址 div 在响应式幻灯片 div 内,允许它在网格大小更改时保持 right-aligned 并且 "snaps" 超过数字像素。有什么方法可以将上层导航整合到响应式网格中吗"snapping"?
网站草稿:http://parkerrichard.com/studiogreen/html/parks.html
所需对齐方式:
HTML:
<body>
<!-- row 1: static navbar -->
<nav class="navbar navbar-default navbar-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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>
<a class="navbar-brand logo" href="index.html"><img class="logo" src="img/logo.png"></a>
</div><!-- navbar toggle -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right nav-stacked hidden-xs">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-lg hidden-md hidden-sm mobile-nav">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
<li class="divider"><img src="img/nav-divider.jpg"></li>
</ul>
</div><!--/nav-collapse -->
</div><!--/container -->
</nav><!--/navbar -->
<!-- row 2: body -->
<div class="container">
<div class="row centered">
<!-- left sidebar -->
<aside class="navbar-collapse collapse panel-group col-lg-4 col-med-5 col-sm-5 col-xs-12" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a href="schools.html">
SCHOOLS
</a>
</h4>
</div>
</div>
</aside>
<!-- slideshow gallery -->
<div class="col-lg-8 col-md-7 col-sm-7 pull-left">
<div class="flexslider no-arrow">
<ul class="slides">
<li>
<img src="img/parks/img-01.jpg" />
</li>
<li>
<img src="img/parks/img-02.jpg" />
</li>
</ul>
</div>
<address class="info-box temp-box temp-add pull-right">
232 SIR FRANCIS DRAKE BLVD</br>
SAN ANSELMO, CA 94960</br>
415 721 0905
</address>
</div><!--/slideshow row -->
</div><!--/body row -->
</div><!--/container -->
CSS:
.container {
width: 100%;
}
/* ==========================================================================
General styles
========================================================================== */
html, body {
overflow-x: hidden;
}
body {
font-family: "proxima-nova", sans-serif;
font-weight: 400;
font-size: 11px;
letter-spacing: .7px;
color: #555;
-webkit-font-smoothing: antialiased;
-webkit-overflow-scrolling: touch;
}
aside {
z-index: 100;
}
address {
text-align: left;
margin-bottom: 30px;
display: none;
}
.info-box {
text-align: left;
font-weight: 400;
padding: 0px 0px 0 55px;
display: none;
}
/* ==========================================================================
Navigation styles
========================================================================== */
/*
* Top nav section
*/
.navbar-header {
padding-bottom: 50px;
}
.navbar-brand {
margin-left: 0px!important;
}
.navbar .nav {
text-align: left;
margin-top: 45px;
}
.navbar .nav > li {
float: none;
display: inline-block;
font-size: 14px;
letter-spacing: 2px;
font-weight: 600;
}
.navbar-default {
background-color: white;
border-bottom: 0px;
}
.navbar-default .navbar-nav > li > a {
color: #555;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .active > a, a:hover, a:active {
color: #6CAA3D;
background-color: transparent;
text-decoration: none;
outline: 0;
}
.navbar-default .navbar-nav > li {
padding: 0px 15px 15px 0px;
}
.navbar-collapse {
margin-top: -65px;
border-top: 0px;
border-color: none;
}
.navbar-default .navbar-collapse {
padding-top: 10px;
overflow-y: visible;
padding-left: 115px;
}
.logo {
margin-top: 10px;
height: 100px;
width: 200px;
}
.navbar-right {
padding: 15px 20px 0 0;
margin-right: 16%;
}
.mobile-nav {
width: 100px;
}
/*
* flexslider styling
*/
.flexslider {
background:none !important;
border:none !important;
box-shadow:none !important;
}
.slides li img {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
/*
Introduced in IE 10.
See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
*/
-ms-user-select: none;
user-select: none;
}
.flex-control-nav {
text-align: right !important;
padding-right: 0px !important;
}
.flex-control-paging li {
margin: 0 0px 0 12px !important;
}
我将导航 div 移到了响应式幻灯片中 div 并添加了一个新样式以放置在右边缘。
已更新HTML:
<body>
<!-- row 1: static navbar -->
<nav class="navbar navbar-default navbar-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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>
<a class="navbar-brand logo" href="index.html"><img class="logo" src="img/logo.png"></a>
</div><!-- navbar toggle -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right hidden-lg hidden-md hidden-sm mobile-nav">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
<li class="divider"><img src="img/nav-divider.jpg"></li>
</ul>
</div><!--/nav-collapse -->
</div><!--/container -->
</nav><!--/navbar -->
<!-- row 1: body -->
<div class="container">
<div class="row centered">
<!-- left sidebar -->
<aside class="navbar-collapse collapse panel-group col-lg-4 col-med-5 col-sm-5 col-xs-12" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a href="schools.html">
SCHOOLS
</a>
</h4>
</div>
</div>
</aside>
<!-- slideshow gallery -->
<div class="col-lg-8 col-md-7 col-sm-7">
<div class="navbar-collapse collapse plibt">
<ul class="nav navbar-nav navbar-right hidden-xs">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
</div>
<div class="flexslider nodot no-arrow pull-left">
<ul class="slides">
<li>
<img src="img/home-slideshow/img-01.jpg" />
</li>
<li>
<img src="img/home-slideshow/img-02.jpg" />
</li>
</ul>
</div>
<!-- address row -->
<address class="info-box pull-right">
232 SIR FRANCIS DRAKE BLVD</br>
SAN ANSELMO, CA 94960</br>
415 721 0905
</address>
</div><!--/slideshow row -->
</div><!--/body row -->
</div><!--/container -->
已添加 CSS:
.plibt {
position: absolute;
right: 0;
top: -150px;
margin: 0 -22px 0px 0 !important;
font-size: 14px;
font-weight: 600;
background: none;
}
.plibt li {
padding: 15px 0px 15px 20px !important;
}
.plibt li a {
background: none !important;
letter-spacing: 2px;
}
目标是让上方导航 (navbar-right) 的右边缘与下方图片幻灯片的右边缘对齐,就像地址文本现在所做的那样,而不会超出幻灯片的右边缘。
问题在于地址 div 在响应式幻灯片 div 内,允许它在网格大小更改时保持 right-aligned 并且 "snaps" 超过数字像素。有什么方法可以将上层导航整合到响应式网格中吗"snapping"?
网站草稿:http://parkerrichard.com/studiogreen/html/parks.html
所需对齐方式:
HTML:
<body>
<!-- row 1: static navbar -->
<nav class="navbar navbar-default navbar-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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>
<a class="navbar-brand logo" href="index.html"><img class="logo" src="img/logo.png"></a>
</div><!-- navbar toggle -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right nav-stacked hidden-xs">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-lg hidden-md hidden-sm mobile-nav">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
<li class="divider"><img src="img/nav-divider.jpg"></li>
</ul>
</div><!--/nav-collapse -->
</div><!--/container -->
</nav><!--/navbar -->
<!-- row 2: body -->
<div class="container">
<div class="row centered">
<!-- left sidebar -->
<aside class="navbar-collapse collapse panel-group col-lg-4 col-med-5 col-sm-5 col-xs-12" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a href="schools.html">
SCHOOLS
</a>
</h4>
</div>
</div>
</aside>
<!-- slideshow gallery -->
<div class="col-lg-8 col-md-7 col-sm-7 pull-left">
<div class="flexslider no-arrow">
<ul class="slides">
<li>
<img src="img/parks/img-01.jpg" />
</li>
<li>
<img src="img/parks/img-02.jpg" />
</li>
</ul>
</div>
<address class="info-box temp-box temp-add pull-right">
232 SIR FRANCIS DRAKE BLVD</br>
SAN ANSELMO, CA 94960</br>
415 721 0905
</address>
</div><!--/slideshow row -->
</div><!--/body row -->
</div><!--/container -->
CSS:
.container {
width: 100%;
}
/* ==========================================================================
General styles
========================================================================== */
html, body {
overflow-x: hidden;
}
body {
font-family: "proxima-nova", sans-serif;
font-weight: 400;
font-size: 11px;
letter-spacing: .7px;
color: #555;
-webkit-font-smoothing: antialiased;
-webkit-overflow-scrolling: touch;
}
aside {
z-index: 100;
}
address {
text-align: left;
margin-bottom: 30px;
display: none;
}
.info-box {
text-align: left;
font-weight: 400;
padding: 0px 0px 0 55px;
display: none;
}
/* ==========================================================================
Navigation styles
========================================================================== */
/*
* Top nav section
*/
.navbar-header {
padding-bottom: 50px;
}
.navbar-brand {
margin-left: 0px!important;
}
.navbar .nav {
text-align: left;
margin-top: 45px;
}
.navbar .nav > li {
float: none;
display: inline-block;
font-size: 14px;
letter-spacing: 2px;
font-weight: 600;
}
.navbar-default {
background-color: white;
border-bottom: 0px;
}
.navbar-default .navbar-nav > li > a {
color: #555;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .active > a, a:hover, a:active {
color: #6CAA3D;
background-color: transparent;
text-decoration: none;
outline: 0;
}
.navbar-default .navbar-nav > li {
padding: 0px 15px 15px 0px;
}
.navbar-collapse {
margin-top: -65px;
border-top: 0px;
border-color: none;
}
.navbar-default .navbar-collapse {
padding-top: 10px;
overflow-y: visible;
padding-left: 115px;
}
.logo {
margin-top: 10px;
height: 100px;
width: 200px;
}
.navbar-right {
padding: 15px 20px 0 0;
margin-right: 16%;
}
.mobile-nav {
width: 100px;
}
/*
* flexslider styling
*/
.flexslider {
background:none !important;
border:none !important;
box-shadow:none !important;
}
.slides li img {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
/*
Introduced in IE 10.
See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
*/
-ms-user-select: none;
user-select: none;
}
.flex-control-nav {
text-align: right !important;
padding-right: 0px !important;
}
.flex-control-paging li {
margin: 0 0px 0 12px !important;
}
我将导航 div 移到了响应式幻灯片中 div 并添加了一个新样式以放置在右边缘。
已更新HTML:
<body>
<!-- row 1: static navbar -->
<nav class="navbar navbar-default navbar-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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>
<a class="navbar-brand logo" href="index.html"><img class="logo" src="img/logo.png"></a>
</div><!-- navbar toggle -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right hidden-lg hidden-md hidden-sm mobile-nav">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
<li class="divider"><img src="img/nav-divider.jpg"></li>
</ul>
</div><!--/nav-collapse -->
</div><!--/container -->
</nav><!--/navbar -->
<!-- row 1: body -->
<div class="container">
<div class="row centered">
<!-- left sidebar -->
<aside class="navbar-collapse collapse panel-group col-lg-4 col-med-5 col-sm-5 col-xs-12" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a href="schools.html">
SCHOOLS
</a>
</h4>
</div>
</div>
</aside>
<!-- slideshow gallery -->
<div class="col-lg-8 col-md-7 col-sm-7">
<div class="navbar-collapse collapse plibt">
<ul class="nav navbar-nav navbar-right hidden-xs">
<li><a href="process.html">PROCESS</a></li>
<li><a href="office.html">OFFICE</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
</div>
<div class="flexslider nodot no-arrow pull-left">
<ul class="slides">
<li>
<img src="img/home-slideshow/img-01.jpg" />
</li>
<li>
<img src="img/home-slideshow/img-02.jpg" />
</li>
</ul>
</div>
<!-- address row -->
<address class="info-box pull-right">
232 SIR FRANCIS DRAKE BLVD</br>
SAN ANSELMO, CA 94960</br>
415 721 0905
</address>
</div><!--/slideshow row -->
</div><!--/body row -->
</div><!--/container -->
已添加 CSS:
.plibt {
position: absolute;
right: 0;
top: -150px;
margin: 0 -22px 0px 0 !important;
font-size: 14px;
font-weight: 600;
background: none;
}
.plibt li {
padding: 15px 0px 15px 20px !important;
}
.plibt li a {
background: none !important;
letter-spacing: 2px;
}