简体   繁体   中英

How to make image buttons stay in place when re-sizing web browser

This is my image-button for my website. http://puu.sh/cK7Sf/6309c39cdb.jpg When I re-size my browser it goes over here http://puu.sh/cK7VU/f17dafcc41.jpg

Here is my code

HTML

<div class="Nav">
        <div id="buttons">
            <a href="/"><div id="home_button"></div></a>

CSS

#home_button {
background-image: url("home.png");
background-repeat:no-repeat;
background-size: 100%;
width: 150px;
height: 60px;
position: absolute;
top: 196px;
left: 502px;
z-index: 10;
}

#buttons div need to have a position: relative; set for abosolut position to vork as you want.

您将要删除“ position:absolute; ”并使用“ float:left;”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM