0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[CSS]TOPへ戻るボタンをつくる

Posted at

CSSでTOPへ戻るボタンをつくる

業務で久々にCSSを触ったので備忘録

動作確認はChromeバージョン: 71.0.3578.98

index.html(抜粋)
<div id="page-top"><span class="page-top-icon">TOP</span></div>
main.css
#page-top {
	position: fixed;
	width: 40px;
	height: 40px;
	right: 8px;
	bottom: 48px;
	background-color: #505168;
	opacity: 0.7;
	border-radius: 50%;
	z-index: 10;
}

.page-top-icon {
	color: #FFF;
	font-size: 16px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    font-weight: bold;
}

右下に「TOP」と表示される

sample.png

参考にしたサイト

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?