DEV Community

Arjun P
Arjun P

Posted on

Can I make a button fixed on screen so it stays in place even when scrolling? How is it done?

Top comments (2)

Collapse
 
syed_mahmoodnabeel_ff7b5 profile image
Syed mahmood Nabeel

Below is the CSS code, you can follow to fix the button while you scroll down the page
.fixed-button {
position: fixed; /* makes the button fixed /
top: 20px; /
distance from the bottom of the screen /
right: 20px; /
distance from the right of the screen */
padding: 10px 20px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 4px 6px rgba(0,0,0,0.2);

Collapse
 
syed_mahmoodnabeel_ff7b5 profile image
Syed mahmood Nabeel

and to customize this you can use diff ai tools according to your requirement