I'm putting an inner-shadow on all my controls, inputs and textareas by using the following CSS:
input {
padding: 7px;
-webkit-box-shadow: inset 2px 2px 2px 0px #dddddd;
-moz-box-shadow: inset 2px 2px 2px 0px #dddddd;
box-shadow: inset 2px 2px 2px 0px #dddddd;
}
and, with some other styling, looks like this (in Firefox, and similar in other browsers):
But the padding that helps separate the content from the inner shadow breaks the textarea around the scrollbar:
and if I remove the padding, the text overlaps the shadow, like this:
I can add padding only to the left, solving the overlap with the left shadow but not with the top shadow, while having the scrollbar look good:
I can also add padding everywhere but on the right side, having the text displayed correctly but the toolbar still looks rather odd:
Is there any way to solve this?
The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations .
Getting the padding
property to affect only the content but not the scrollbar is not possible using standard textarea elements. For that you can use a contenteditable
DIV. For example, check this fiddle: http://jsfiddle.net/AQjN7/
HTML:
<div class="outer" contenteditable="true">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
CSS:
.outer {
-webkit-box-shadow: inset 2px 2px 2px 0px #dddddd;
-moz-box-shadow: inset 2px 2px 2px 0px #dddddd;
box-shadow: inset 2px 2px 2px 0px #dddddd;
height: 200px;
margin: 10px;
overflow: auto;
padding: 7px 10px;
width: 300px;
font-family: tahoma;
font-size: 13px;
border: 1px solid #aaa;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With