How do I get text to stay in place over a 100% wid

2019-08-30 13:43发布

So I have a header which is set to 100% width on my page and I want to put text on the banner and stay in place but when I zoom in and out the position of the text changes. How do I make it so that the text stays place to the place I set it and zooming in and out does not affect it?

Fiddle : jsfiddle.net/5ASJv/

html

<div id="wrap">
<div class="right">
   Hey <br />
    What is up <br />
</div></div>

css

* {
margin: 0 auto;
}

#wrap {
height: 150px;
width: 100%;
background: url(http://froggyadventures.com/wp-content/uploads/galleries/post-93/full/placeholder%20-%20Copy%20(2).gif) no-repeat center;
text-align: center;
background-color: #FFF;
}
.right{
width: 400px;
height: 110px;
position: relative;
z-index: 999;
top: 100px;
left: 100px;
}

标签: css html
1条回答
男人必须洒脱
2楼-- · 2019-08-30 14:35

Try this:

* {
margin: 0 auto;
}

#wrap {
height: 150px;
width: 100%;
background: url(http://froggyadventures.com/wp-content/uploads/galleries/post-93/full/placeholder%20-%20Copy%20(2).gif) no-repeat center;
text-align: center;
background-color: #FFF;
position: relative;
}
.right{
width: 400px;
height: 110px;
position: absolute;
z-index: 999;
top: 100px;
left: 100px;
}
查看更多
登录 后发表回答