English 中文(简体)
添加不太具体的类别而不进口!
原标题:Add less specific class without !important

我有以下特别安全局规则:

.bookItem:hover { background: rgba(0,150,255,0.1); }

.selected { background: rgba(0,150,255,0.2) !important; }

在点击一台书刊时,我用“ j子”来增加选修课。 问题在于,没有<代码>! 进口,选定类别在停用之前没有显示。 我知道这一点,因为:hover pseudoster使这一选择人“更加具体”。

有可能修改<代码>。 a. 职业介绍 www.un.org/chinese/ga <代码>! 进口?

最佳回答

我认为,你完全应该重新考虑使用这些关键词。 ! 进口是一种过于强大的工具,它主要摧毁所有等级体系,使你们的法典变得非常困难。 它的使用应限于少数极端的例子,否则就不存在。

我再次认为,你应尽量利用尽可能多的html标签,然后使用课堂和女婴,最后是具体指针。 我要谈谈像我的同胞一样由我组成的班子:

.bookitem.selected { back... ; }

最后,为了获得更多信息,可读到

问题回答

页: 1 更一般的班级,这样就能够到任何地方,而不仅仅是在.bookItem要素上,它为我强迫登上而工作。

.selected,.selected:hover { background: rgba(0,150,255,0.2)}

a working example

This is a problem of specificity. In you stylesheet define .selected like this

div item#books .selected {bacground: rgba(0,150,255,0.2);}

http://css-tricks.com/855-specifics-on-css-specificity/





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...