背景画像とテキストを中央に配置し、幅と高さを 100% に設定したメニューを作成したいと考えています。
私はそのようなコードを持っています:
<div id="wrapper">
<div id="container">
<div><a class="aMenuHref" href="#">My Link</a></div>
</div>
</div>
.aMenuHref{
font-size: large;
height: 35px;
display: inline-block;
width: 100%;
}
#container {
width: 100%;
height: 35px;
position: relative;
background: url(images/back1.jpg) no-repeat 0 0px;
}
#wrapper > #container {
display: table;
position: static;
}
#container div {
position: absolute;
top: 50%;
}
#container div div {
position: relative;
top: -50%;
}
#container > div {
display: table-cell;
vertical-align: middle;
position: static;
}
#container:hover{
background: orange;
}
しかし、私の href にはありませwidth: 100%
んheight: 100%
。
ありがとう!