如何在CSS文件中使一个类继承自另一个类?
- input.btn {
- border:1px solid #23458c;
- background:url('gfx/layout.btn_bg.png');
- color:#f0f5fa;
- font-weight:bold;
- margin-right:6px;
- padding:1px 6px 2px 6px;
- cursor:pointer;
- }
- input.btn_light {
- border:1px solid #717b8f;
- background:url('gfx/layout.btn_light_bg.png');
- }
在这里,我希望input.btn_light继承自input.btn ..如何在CSS文件中做到这一点?
@vadiklk
- input.btn {
- border:1px solid #23458c;
- background:url('gfx/layout.btn_bg.png');
- color:#f0f5fa;
- font-weight:bold;
- margin-right:6px;
- padding:3px 6px 4px 6px;
- cursor:pointer;
- }
- input.btn_light {
- input.btn;
- border:1px solid #717b8f;
- background:url('gfx/layout.btn_light_bg.png');
- }
解决方法
为HTML元素提供两个类:
- <input type="submit" class="btn btn_light" value="Action" />