Search code examples
htmlcssadaptive-design

Adaptive Design: How to Attach button to the picture?


How can I attach button to the specific place on the picture in adaptive design? How attach button "Sign In" to the specific place? When I change a size of window Button change location

<head>
    <link href="style/bootstrap.css" rel="stylesheet">
    <link href="style/style.css" rel="stylesheet">
</head>

<body>
    <div class="first-block">
        <div style="width:100%;">
            <div class="navbar  navbar-static-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data- toggle="collapse" data-target="#responsive-menu">
                         <span class="sr-only">Меню</span>
                   <span class="icon-bar"></span>
                   <span class="icon-bar"></span>
                   <span class="icon-bar"></span>
                </button>
                    </div>
                    <div class="collapse navbar-collapse" id="responsive- menu">
                        <div class="nav navbar-nav">
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                        </div>
                    </div>
                </div>
            </div>
            <div class="button-parent">
                <button class="button registration1 col-xs-2    col-sm-2    col-md-2 col-lg-2">
        <a href="" style="font: 18px white;">Зарегистрироваться</a>
    </button>
            </div>

        </div>
    </div>
    <div class="second-block">
        <div style="width:100%">
            <div class="button-parent">
                <button class="button registration2 col-xs-2    col-sm-2    col-md-2 col-lg-2">
        <a href="" >Sign IN</a>
        </button>
            </div>
            <img src="https://s32.postimg.org/nwl1muvv9/2_3.jpg" class="img-responsive">
        </div>
    </div>

    <div class="third-block">
        <img src="https://s32.postimg.org/lnyflujyd/image.jpg" class="img-responsive">
    </div>
</body>

html, body {
    width: 100%;
    height: 100%;
}
.first-block {
    background: url(https://s32.postimg.org/heab1dm7p/image.jpg) center no-repeat;
    background-size: cover;
    width: 100%;
    height: 100%;


}

.button{
  height: 5%;
     border-radius: 20px; 
       background-color:#19A4EC;
  position: absolute;  
}
.registration1{

    left:42%;
    top: 70%;

}
 .button-parent{
  margin: 0 auto;
} 

 .registration2{
    height: 7%;
    left:25%;
    top: 303%;

}

JSFiddle


Solution

  • You can try to enter in the href attribute with the link to the page you want to link the button:

    <button class="button registration2 col-xs-2    col-sm-2    col-md-2 col-lg-2">
        <a href="https://www.youtube.com/">Sign IN</a>
    </button>