Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling input text CSS

Tags:

css

I am trying to create input text like below Image :
enter image description here
First I used CSS3 with some help like this fiddle . because of problems with old browsers I reached to don't use CSS3. Now I coded like this :

input[type=text]
{
    color: #979797;
    height: 28px;
    padding-left: 10px;
    text-decoration: none;
        background-image: url('Pictures/Input-BG.png');
    background-repeat: repeat-x;

}
   <input id="txtScrictAddress" value="Your Adress (required)" type="text" />

Input-BG.png is this image :
enter image description here
and here is the result.

  1. Did I slice input image right ?
  2. Input has a left border color , How should style the input in css like the image?
like image 880
Shahin Avatar asked Aug 23 '11 06:08

Shahin


People also ask

How do you style input in CSS?

Styling Input Fields If you only want to style a specific input type, you can use attribute selectors: input[type=text] - will only select text fields. input[type=password] - will only select password fields. input[type=number] - will only select number fields.

Can we use style in input tag?

A style attribute on an <input> tag assigns a unique style to the input control. Its value is CSS that defines the appearance of the input element.

What is styling form with CSS?

CSS form is used to create interactive forms for users and provides many ways to set the style. There are many CSS properties available that can be used to create and style HTML forms to make them more interactive.


1 Answers

You just need to set a border radius and border to none. And edit your image so the dark thing is on the left side also.

input[type=text]
{
    color: #979797;
    height: 28px;
    padding-left: 10px;
    text-decoration: none;
    background-image: url('http://i.stack.imgur.com/pbpVI.png');
    background-repeat: repeat-x;
    border-radius: 5px; /*up to date browsers support this, but you can add prefixes if you want*/

    border: 0;
}

http://jsfiddle.net/TGzng/8/

like image 158
Kyle Avatar answered Nov 16 '22 19:11

Kyle