Skip to content Skip to sidebar Skip to footer

-webkit- Textarea Losing Top & Bottom Padding On Vertical Scrollbar

I have a textarea element with fixed width & height and no resize and when the vertical scrollbar appears the padding (top & bottom) of the element is ignored. Here is a pl

Solution 1:

I've tried to think of a workaround, depending on your own hint. You've got it right, but didn't implement it yet. :) I just coded your idea. What I did was to enclose within a wrapper, and setting before and after pseudo elements to just hide the top and bottom parts. I hope that would solve your issue.

It would also run perfectly in Chrome, Firefox as well as in IE.

.container {
    width: 90%;
    position: relative;
}
textarea {
	background-color: #1c1b1b;
	border:0;
    border-radius: 4px;
    color: #fff;
    display: block;
    height: 165px;
    margin-bottom: 21px;
    padding: 10px;
    resize: none;
    width: 100%;
	border-radius: 4px;
}
.container:before, .container:after {
	content:'';
    display: block;
    height: 10px;
    background: #1c1b1b;
    position: absolute;
    left: 4px;
    right: 18px;
}
.container:before {
    top: 0px;
}
.container:after {
    bottom: 0px;
}
<divclass="container"><textarea>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea></div>

Post a Comment for "-webkit- Textarea Losing Top & Bottom Padding On Vertical Scrollbar"