2012-12-05 27 views

回答

5

將兩個柱絕對放置在共同的祖先元素內。例如:

​<header> 
    <nav><a href="#">Foobar</a></nav> 
    <img src="http://placekitten.com/640/200" /> 
    <nav><a href="#">Foobar2</a></nav> 
</header>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ 

並用以下的CSS:

​header { 
    position: relative 
} 
nav:nth-of-type(1) { 
    top: 0 
} 
nav:nth-of-type(2) { 
    bottom: 0 
} 
nav { 
    background-color: rgba(0,255,0,.25); 
    box-sizing: border-box; 
    position: absolute; 
    width: 100%; 
} 

它給你以下幾點:http://jsfiddle.net/M3jyV/

+1

+1對於貓的形象。我總是用我的例子做同樣的事情:) – Hubro

1

試試這個CSS

and make the inline css to external css its for your reference (inline css). 

bootstrap.css line 5416 

#masthead.container { 
    padding: 0; 
    position: relative; 
    width: 1198px; 
} 


app.css line 13 

#banner { 
    position: absolute; 
} 

bootstrap.css line 3779 

.navbar { 
    color: #777777; 
    overflow: visible; 
    position: absolute; 
    width: 100%; 
} 


<div class="container" style="width:100%"> 
<header style="margin-top: -40px;" class="navbar" role="banner"> 

看到圖像:

enter image description here