How can I make the button with position: fixed
property only visible inside the second div and not remain fixed when scrolling to the first or last div?
.one{
height:600px;
width: 100%;
background-color: red;
}
.two{
height:600px;
width: 100%;
background-color: yellow;
}
.three{
height:600px;
width: 100%;
background-color: pink;
}
.mybutton{
width:80px;
height: 20px;
position: fixed;
right:10px;
top:100px;
}
<html>
<head>
<body>
<div class="one">
<button class="mybutton">Click</button>
</div>
<div class="two"></div>
<div class="three"></div>
</body>
</head>
</html>