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
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 #ffffdffffd;
-moz-box-shadow: inset 2px 2px 2px 0px #ffffdffffd;
box-shadow: inset 2px 2px 2px 0px #ffffdffffd;
height: 200px;
margin: 10px;
overflow: auto;
padding: 7px 10px;
width: 300px;
font-family: tahoma;
font-size: 13px;
border: 1px solid #aaa;
}
You could wrap the textarea in a div:
<div class="textarea-wrapper">
<textarea>
</div>
css:
.textarea-wrapper{
box-shadow: inset 2px 2px 2px 0px #ffffd;
}
textarea {
padding: 10px;
background: transparent;
border: none;
}
A jsFiddle here: http://jsfiddle.net/rXpPy/
Additionally - rather than using simply input, which will target buttons, you can target text inputs specifically with
input[type="text"]
You can just add: padding-right: 0;
to the textarea selector and it will line up your scrollbar with the side of the element. :)