Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assigning background color and text-color of button in HTML style

I have a button and trying to give to style properties for it in the same html statement but not getting the correct output.

<button style="color:yellow" style="background-color:blue" type="button" onclick="alert('Hello world!')">Click Me!</button>

I want to give text color as yellow and background color as blue in this html code only without using any kind of css. How should I do it?

like image 985
user11066242 Avatar asked Jan 26 '23 17:01

user11066242


1 Answers

You need to keep all of your style properties in a single tag and separate them with semi-colons.

<button style="color:yellow; background-color:blue;" type="button" onclick="alert('Hello world!')">Click Me!</button>
like image 126
Russ J Avatar answered Jan 31 '23 07:01

Russ J