1

画像の水平方向と垂直方向の中央にテキストを数行配置する必要があります。インターネットで多くのことを読みましたが、解決策はありませんでした。

HTML:

<div id="textContainer">
    Preparing for important meeting? <br />
    <b>Drink some coffeee!</b> <br />
    <img src="http://i.imgur.com/me2octq.jpg" />
</div>


<div id="baner">
    <div class="imgBaner"></div>
</div>

CSS:

.imgBaner {
    margin: 0 auto;
    width: 100%;
    height: 460px;
    background: url(http://i.imgur.com/5pijCrS.jpg) no-repeat center;
    position: relative;
}


#textContainer {
    position: absolute;
    font-size: 32px;
    text-align: center;
    z-index: 1;
    color: yellow;
}

また、私はフィドルを同封しています: http://jsfiddle.net/vXzKc/

私はすべての助けに感謝します!

4

1 に答える 1