-3

I am very new to CSS, and was wondering how to apply a class to a button. For example, suppose I had this class:

.myclass
{
background-color: #ff0000;
}

How would I properly apply that to a button?
I am really new to CSS, and appreciate your help!

4

2 回答 2

3

只需将按钮的class属性设置为您的 CSS 类:

<button class="myclass">Button text</button>
于 2013-06-12T23:21:18.943 回答
1

如果你使用<button>,你可以做<button class="myclass">Hello world</button>

如果你使用<input />,那么它是 <input name="hello" type="submit" value="Hello world" class="myclass" />

于 2013-06-12T23:22:58.817 回答