LoginSignup
0
0

More than 3 years have passed since last update.

ページトップへ戻るボタンの作成

Last updated at Posted at 2021-04-06

①hederの中に下記を記載する
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.4/css/all.css">

②bodyの中に下記を記載する
<div id="page_top"><a href="#"></a></div>

③CSSに下記を記載する

page_top{

width: 50px;
height: 50px;
position: fixed;
right: 0;
bottom: 0;
background: #3f98ef;
opacity: 0.6;
border-radius: 50%;
}

page_top a{

position: relative;
display: block;
width: 50px;
height: 50px;
text-decoration: none;
}

page_top a::before{

font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: '\f102';
font-size: 25px;
color: #fff;
position: absolute;
width: 25px;
height: 25px;
top: -5px;
bottom: 0;
right: 0;
left: 0;
margin: auto;
text-align: center;
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0