wide
wide

Reputation: 11

How I make input value first-letter uppercase?

So I have made all buttons first letter uppercase and all other lowercase. But I don't know how to make it happen with input value. Why i want this is because if someone/I change value to lowercase it still be how it should be. I try to be more clear It is contact page submit button

<input type="submit" name="commit" value="send">

I don't know why but in jsfiddle this code below works fine but not in my code where it is all capitalized . I'm using less btw.

input[type=submit] {
  text-transform: capitalize;
 }

Upvotes: 1

Views: 1815

Answers (5)

Code Master
Code Master

Reputation: 1

There is no such possibility to use pseudo element like first-letter, first-line or first-child for inputs. For buttons we can use <button type="submit">Submit</button> instead of <input type="submit" value="submit"/> to use the pseudo elements.

Upvotes: 0

Shakir Ahamed
Shakir Ahamed

Reputation: 1308

try this

.capitalize {
    text-transform: capitalize;
}
 
.uppercase {
     text-transform: uppercase;
}

.lowercase {
   text-transform: lowercase;
} 
 
<input type="Submit" value="Submit" class="uppercase" />

Upvotes: 0

Dipnesh Parakhiya
Dipnesh Parakhiya

Reputation: 542

<input type="submit" name="commit" value="send" style="text-transform: capitalize;">

apply style:style="text-transform: capitalize;"

Upvotes: -1

Andrej
Andrej

Reputation: 74

Would text-transform: capitalize; help?

input{
    text-transform: capitalize;
}

Upvotes: -1

Harish Kommuri
Harish Kommuri

Reputation: 2854

Use text-transform: capitalize; for input[type=submit].

input[type=submit] {
  text-transform: capitalize;
}
<input type="submit" name="commit" value="send">

Upvotes: 6

Related Questions