skip to Main Content

I want to style the value attribute of the input tag

<input type="button" value="see me there">

My CSS code:

input:value{
Color: red;
}

I also tried:

input[type=value] {
Color: red;
}


input:value{
Colour: red;
}

2

Answers


  1. you have a typo in you color css attribute: https://developer.mozilla.org/en-US/docs/Web/CSS/color

    input {
    color: red;
    }
    <input type="text" value="my value" />    
    <input type="button" value="my value" />
    Login or Signup to reply.
  2. Style the <input> with an rgba() color. You can affect the transparency of the text that way:

    input {
        color: rgba(200, 200, 250, 0.5);
        background-color: #369;
    }
    
    div {
        background-color: #22F;
        padding: 2em;
        display: inline-block;
    }
    <div>
        <input type=button value="A Button">
    </div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search