开发者

How do I format the scrollbar style on a textarea?

开发者 https://www.devze.com 2023-03-28 05:35 出处:网络
I\'m sure this shouldn\'t be as difficult as it seems... I can\'t use a JQuery scrollpane because I need it to act as a standard form textarea when it gets submitted.. needs to work in IE7+, Safari &a

I'm sure this shouldn't be as difficult as it seems... I can't use a JQuery scrollpane because I need it to act as a standard form textarea when it gets submitted.. needs to work in IE7+, Safari & firefox at least... any ideas?

Tried this...

textarea {
    scrollbar-face-col开发者_C百科or: #ff8c00;
    scrollbar-track-color: #fff8dc;
    scrollbar-arrow-color: #ffffff;
    scrollbar-highlight-color: #fff8dc;
    scrollbar-shadow-color: #d2691e;
    scrollbar-3dlight-color: #ffebcd;
    scrollbar-darkshadow-color: #8b0000;
}

... but only works in IE ?

Any ideas??


Use -webkit-scrollbar pseudo-elements for scroll bar:

textarea::-webkit-scrollbar {
    width: 1em;
}

textarea::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}

textarea::-webkit-scrollbar-thumb {
  background-color: darkgrey;
  outline: 1px solid slategrey;
}

You can find more detail here: https://css-tricks.com/almanac/properties/s/scrollbar/


I have never done this so im not completely sure on this, but I remember one my colleagues was doing this for a site we were developing and he had the same minor issue.

I think you are along the right track, although the scrollbar properties need to be in the body css like so:

body {
 scrollbar-face-color: #ff8c00;
    scrollbar-track-color: #fff8dc;
    scrollbar-arrow-color: #ffffff;
    scrollbar-highlight-color: #fff8dc;
    scrollbar-shadow-color: #d2691e;
    scrollbar-3dlight-color: #ffebcd;
    scrollbar-darkshadow-color: #8b0000;
}

Maybe you could try giving the desired text area and id property and apply that in the css, so:

textarea.(insertrelevantID) {
.....
}
0

精彩评论

暂无评论...
验证码 换一张
取 消