Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html button styles

Tags:

html

button

How can you add multiple styles to the one button...this doesn't work.

<button style="background:red", "cursor:pointer">click me</button>

I have tried:

  • style="background:red", "cursor:pointer"
  • style="background:red" "cursor:pointer"
  • style="background:red" style="cursor:pointer"

is it possible to combine multiple styles?

like image 711
Ricco Avatar asked Sep 04 '11 03:09

Ricco


1 Answers

You should really use a css class and avoid styling DOM nodes inline:

<style type="text/css">
    .btn {
        background-color:red;
        cursor:pointer;
    }
</style>

<button class="btn">Click me</button>

Even more ideally you'd create a CSS file.

CSS (style.css) :

.btn {
    background-color:red;
    cursor:pointer;
}

HTML :

   <link rel="stylesheet" href="style.css" />
   <button class="btn">Click me</button>
like image 132
AlienWebguy Avatar answered Nov 02 '22 17:11

AlienWebguy