How to set text color in submit button?
Asked Answered
D

7

47

I tried to change the color of the text in the submit button type but, I don't know why I am not able to change it.

.button {
  width: 105px;
  height: 20px;
  background-image: url('tiny.gif');
  line-height: 20px;
  padding-bottom: 2px;
  vertical-align: middle;
  font-family: "Lucida Grande", Geneva, Verdana, Arial, Helvetica, sans-serif;
  font-size: 13px;
  <!--font-weight: bold;
  -->text-transform: none;
  border: 1px solid transparent;
}

.button:hover {
  background-image: url('tiny_.gif');
}
<input type="submit" value="Fetch" class="button" />

I was getting a problem when I tried to change the color of the submit button.

Doralyn answered 18/9, 2012 at 5:54 Comment(1)
"Getting problems" -- this does't help us at all. What are you expecting to have happen? What is actually happening? Are there any messages in your console log? I added background-color: red to your :hover and the button changed colors when I moused over. Perhaps tiny_.gif isn't loading?Equinox
H
84

.button
{
    font-size: 13px;
    color:green;
}
<input type="submit" value="Fetch" class="button"/>
Hindsight answered 18/9, 2012 at 6:7 Comment(0)
F
24

you try this:

<input type="submit" style="font-face: 'Comic Sans MS'; font-size: larger; color: teal; background-color: #FFFFC0; border: 3pt ridge lightgrey" value=" Send Me! ">
Famagusta answered 18/9, 2012 at 6:18 Comment(2)
Inline styles are not a good idea when an external stylesheet is available.Celebrity
it's very good idea for poor css-ed pages, and for test how page will be rendered. for full css-ed pages this should be moved to external css file.Fiddlededee
B
7
<button id="fwdbtn" style="color:red">Submit</button> 
Bartonbartosch answered 4/12, 2014 at 9:30 Comment(0)
T
5

Use this CSS:

color: red;

that's all.

Torietorii answered 18/9, 2012 at 5:57 Comment(0)
L
2

I had the same thought of wanting to change the text color rather than the button color itself to a different color. Here's what you can do:

button {
    color: black; /* This is for the font color of the button */
    background-color: aqua; /* This is for the color of the button */
    height: 70px;
    width: 70px;
}
Leonardaleonardi answered 20/11, 2022 at 0:53 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Kristalkristan
H
-1
.btn{
    font-size: 20px;
    color:black;
}
Howlond answered 18/12, 2020 at 9:30 Comment(2)
Could you explain your solution, only code is a bit hard to undestand correctly the answerUpholstery
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.Simulant
K
-2
<input type = "button" style ="background-color:green"/>
Kumamoto answered 15/5, 2016 at 16:4 Comment(1)
OP wants to change text color of a submit and you provide him with an inline style (=bad practice) changing background color of a button. This doesn't help much...Frigidaire

© 2022 - 2024 — McMap. All rights reserved.