1 sonuçtan 1 ile 1 arası

Konu: Change Scrollbar Color in CSS Websites

  1. #1
    Administrator yilmaz - ait Kullanıcı Resmi (Avatar)

    Bilgi

    Change Scrollbar Color in CSS Websites

    In this HTML and CSS tutorial, I will show you how to change and customize the side ScrollBar without using any JavaScript files. You will be able to create ScrollBar in the color and style you want. First we will have two files, index.html and style.css. Let's add basic HTML codes to index.html immediately.


    We linked the style.css to the index.html page with the link tag. Since our goal in this tutorial is to replace the ScrollBar, I need to add a paragraph that will reveal the ScrollBar. Let's do this right away with the P tag, by adding Dummy Text to it. This is how we add Dummy Texts. And when I save this file, you will see the ScrollBar on the right. Now let's move on to the style.css file to customize this ScrollBar. First of all, I added a body tag and gave the margins to make the page look nicer. I opened the lines. Now let's use the Justify code, where we justify the texts on both sides. So it will look more organized. Now that we have prepared the page in general, we can move on to customizing the ScrollBar. To customize the ScrollBar, we will use some codes on CSS and try these codes to see what they do. Primarily covering the scrollbar in general. We are adding the Webkit ScrollBar feature. We can apply different parameters to this property, let's start with the Background first. When we assign black color to the Background property, the scroll bar will be black as you can see here. The point where we hold the scrollbar will not be visible at the moment. Because right now we haven't determined it yet.


    I transfer the ScrollBar color by choosing a color from here. Let's add a color like this and we'll make the slider even darker. Now let's set its width. We will use the width value, if you want it to be thin, we can use 10 pixels or if we want it to be thicker, we can increase the number here. Let it stay at 14 events for now.

    HTML-Kodu:
    1. ::-webkit-scrollbar {
    2. background: #95a5a6;
    3. width: 14px;
    4. }
    5. ::-webkit-scrollbar-thumb {
    6. background: #2c3e50;
    7. }
    Demo 1:


    HTML-Kodu:
    1. /* width */
    2. ::-webkit-scrollbar {
    3. width: 20px;
    4. }
    5. /* Track */
    6. ::-webkit-scrollbar-track {
    7. box-shadow: inset 0 0 5px grey;
    8. border-radius: 10px;
    9. }
    10. /* Handle */
    11. ::-webkit-scrollbar-thumb {
    12. background: #2c3e50;
    13. border-radius: 10px;
    14. }
    15. /* Handle on hover */
    16. ::-webkit-scrollbar-thumb:hover {
    17. background: #b30000;
    18. }
    Demo 2


Konu Bilgileri

Bu Konuya Gözatan Kullanıcılar

Şu an 1 kullanıcı var. (0 üye ve 1 konuk)

Konuyu Okuyanlar: 0

Şu anda listelemek için üye yok.

Yetkileriniz

  • Konu Acma Yetkiniz Yok
  • Cevap Yazma Yetkiniz Yok
  • Eklenti Yükleme Yetkiniz Yok
  • Mesajınızı Değiştirme Yetkiniz Yok
  •