0

I want to get a textfield effect using CSS3 like this :-

enter image description here

I tried to do that using CSS3 but yet not succeeded to get exactly the same look, please find my code here in jsfiddle.net

CSS

.field {
-webkit-box-shadow: inset 0px 1px 4px 1px #929292;
-moz-box-shadow: inset 0px 1px 4px 1px #929292;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset;
width: 277px;
height: 18px;
border-top: #9f9e9e 1px solid;
border-right: #c9c9c9 1px solid;
border-bottom: #ececec 1px solid;
border-left: #c9c9c9 1px solid;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
outline: none;
padding: 6px 8px;
font-size: 13px;
line-height: 16px;
color: #333;
}

HTML

<input type="text" name="name" value="" class="field">

Thanks in advance.

1 Answer 1

1

It is difficult to define "exactly the same look". Any way, that is my try:

updated demo

I have changed box-shadow, and given it a second shadow

box-shadow: inset 0px 1px 2px 1px rgba(0, 0, 0, 0.3), 
            inset 0px -1px 1px 1px rgba(0, 0, 0, 0.2);

The key issue here is that you can set as many shadows as you want, even of the same kind (I mean both being "inset"). This way, you can get almost whatever you want. Even more, if you are using alpha in the colors.

By the way, I think you can drop -webkit-border-radius.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.