如何向一个按钮添加多种样式...这行不通。
<button style="background:red", "cursor:pointer">click me</button>
我试过:
style="background:red", "cursor:pointer"
style="background:red""cursor:pointer"
style="background:red"style="cursor:pointer"
是否可以组合多种样式?
最佳答案
你真的应该使用 css 类并避免内联样式化 DOM 节点:
<style type="text/css">
.btn {
background-color:red;
cursor:pointer;
}
</style>
<button class="btn">Click me</button>
更理想的情况是您创建一个 CSS 文件。
CSS(样式.css):
.btn {
background-color:red;
cursor:pointer;
}
HTML:
<link rel="stylesheet" href="style.css" />
<button class="btn">Click me</button>
关于html按钮样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7297174/