How to make a back-to-top button using CSS and HTML only?

前端 未结 12 1663
别那么骄傲
别那么骄傲 2020-12-28 16:11

What i\'m trying to do is kind of like a back to top button but to scroll down and up to a certain point on the page! Say for instance you have a long text and

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 16:25

    HTML

    
    
    
    

    CSS

    #btn {  
        position: fixed;
        bottom: 10px;
        float: right;
        right: 20.5%;
        left: 77.25%;
        max-width: 90px;
        width: 100%;
        font-size: 12px;
        border-color: rgba(5, 82, 248);
        background-color: rgb(5, 82, 248);
        padding: .5px;
        border-radius: 4px;
        font-family: Georgia, 'Times New Roman', Times, serif;
    }
    

    On Hover Color Change

    #btn:hover {
        background-color: #fafafa;
    }
    

提交回复
热议问题