Can I style the resize grabber of textarea?

后端 未结 5 723
北恋
北恋 2020-11-27 18:46

My designer just gave me the design with text areas with styled resize grabber. The question is: Can I style it or not ?

5条回答
  •  旧巷少年郎
    2020-11-27 19:34

    Instead of applying CSS to ::-webkit-resizer (which doesn't appear to be working in Chrome 56 or FireFox 51), you can create a "custom" handle using some markup. I found this example after a google search:

    Custom CSS3 TextArea Resize Handle

    Copied markup in case of future dead link:

    And the CSS from the example - of course, you can apply any style you like :

    textarea {
        position: relative;
        margin: 20px 0 0 20px;
        z-index: 1;
    }
    .wrap {
        position: relative;
        display: inline-block;
    }
    .wrap:after {
        content:"";
        border-top: 20px solid black;
        border-left: 20px solid transparent;
        border-right: 20px solid transparent;
        -webkit-transform: rotate(-45deg);
        z-index: 1;
        opacity: 0.5;
        position: absolute;
        right: -18px;
        bottom: -3px;
        pointer-events: none;
    }
    .pull-tab {
        height: 0px;
        width: 0px;
        border-top: 20px solid cyan;
        border-left: 20px solid transparent;
        border-right: 20px solid transparent;
        -webkit-transform: rotate(-45deg);
        position: absolute;
        bottom: 0px;
        right: -15px;
        pointer-events: none;
        z-index: 2;
    }
    

提交回复
热议问题