我们来看看这个HTML:
<div id="work">
<div id="header">
<a href="index.html#content" class="backlink">Startseite</a>
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
这个CSS:
html,
body {
height: 100%;
background: orange;
}
#work {
height: 100%;
background: grey;
}
#header {
display: table;
height: 50%;
width: 100%;
margin: 0 auto;
background: blue;
}
.backlink {
display: block;
width: 120px;
height: 100%;
margin: 0 auto;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
background: url('http://www.myparisnet.com/wp-content/images/Tour-Eiffel-052.fullsize.JPG') no-repeat center center;
background-size: auto 90%;
background-color: red;
}
在Safari中,'。backlink'(红色背景)填充'#header'(蓝色背景)高度的100%。在Firefox中,情况并非如此。标题大小正确,但不是.backlink
- 为什么?我该怎么做才能使.backlink
高度达到100%?