html button styles
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?
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>
Separate properties with ;
and put all properties between the same set of quotes:
<button style="background:red; cursor:pointer">click me</button>
http://jsfiddle.net/userdude/GcY97/
The same goes for CSS class declarations:
button {
background: red;
cursor: pointer;
}
You separate all html style properties with a semicolon - ;
style="background: red; cursor: pointer;"
精彩评论