[Online Tutorials] 스크롤바 커스텀하기

·2021년 5월 16일
0

공부한 것

목록 보기
4/58
post-thumbnail

✍🏻 스크롤바 커스텀

Con.A에서 스크롤바를 커스텀 하기 위해 방법을 찾고있다. 일반적으로 css만 사용하지 않고 브라우저 스크롤바를 숨기고 대체할 수 있는 별도의 스크롤바를 만들어 사용한다고 한다. 다음은 css속성을 사용하는 방법이다.(모든 브라우저에 적용되지 않는다)

코드

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Custom Scrollbar</title>
</head>
<body>
    <section></section>
    <section></section>
    <section></section>
</body>
</html>
body {
    margin: 0;
    padding: 0;
    background-color: #000;
    scrollbar-width: thin;
    scrollbar-color: #30ff00 #fff;
}

section {
    width: 100%;
    height: 100vh;
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(#000, #30ff00);
    border-radius: 6px;
}

결과

참고강의

https://www.youtube.com/watch?v=fx8Lg1A5IZs

0개의 댓글