继承css样式

时间:2013-04-30 07:14:52

标签: css

以下是两个CSS。

我希望helpContent拥有itemContent的所有样式。如何让helpContent继承itemContent

.itemContent {
    BORDER-RIGHT: #ababe3 1px solid;
    BORDER-TOP: #ababe3 1px solid;
    DISPLAY: block;
    PADDING-LEFT: 3px;
    PADDING-BOTTOM: 3px;
    PADDING-TOP: 3px;
    OVERFLOW: hidden;
    BORDER-LEFT: #ababe3 1px solid;
    WORD-WRAP: break-word;
    POSITION: static;
}
.helpContent {
    BACKGROUND: #eff5ff;
}

2 个答案:

答案 0 :(得分:6)

最简单的方法是

.itemcontent, .helpcontent  {
    border-right: #ababe3 1px solid; 
    border-top: #ababe3 1px solid; 
    display: block; 
    padding-left: 3px; 
    padding-bottom: 3px; 
    padding-top: 3px; 
    overflow: hidden; 
    border-left: #ababe3 1px solid; 
    word-wrap: break-word;
    position: static;
}
.helpcontent {
    background: #eff5ff; 
}

答案 1 :(得分:0)

最短的方式是:

.itemcontent, .helpcontent  {
    border: 1px solid #ababe3;
    border-bottom: none;
    display: block; 
    padding: 3px 0 3px 3px; 
    overflow: hidden; 
    word-wrap: break-word;
    position: static;
}
.helpcontent {
    background: #eff5ff; 
}