[英]CSS not applying to my div
I have a div that I really need to apply my css attributes to. 我有一个div,我确实需要将css属性应用到该div。 The page is structured like this:
该页面的结构如下:
<div class="form-horizontal">
<div class="form-group">
<div class="newFormRightContent">
I have a .form-group in my stylesheet and that comes out fine on the page, but my .newFormRightContent styles never get assigned. 我的样式表中有一个.form-group,在页面上显示出来很好,但是我的.newFormRightContent样式从未分配。 I am using chrome inspect element and can see that at newFormRightContent level, the styles are inherited from form-group and from the user-agent ss.
我正在使用chrome inspect元素,可以看到在newFormRightContent级别,样式是从form-group和user-agent ss继承的。
I have tried various combo's of selectors in my css: 我在CSS中尝试了各种选择器组合:
div.form-group.newFormRightContent {
.form-group.newFormRightContent {
.newFormRightContent {
None seem to work - can someone please educate me on my failings here please!! 似乎没有任何效果-有人可以在这里让我了解我的失败吗!
Many thanks 非常感谢
You have to leave space between .form-group and .newFormRightContent 您必须在.form-group和.newFormRightContent之间留出空间
.form-group .newFormRightContent{
and try to set your styles !important
并尝试设置您的样式
!important
Try this: 尝试这个:
.form-horizontal > .form-group > .newFormRightContent
This will make sure only nested situation gets the design and no other situations get modified. 这将确保只有嵌套情况才能获得设计,而其他情况不会得到修改。 Not using the child
>
selector will result in unnecessary design override in some other places where the given order is not maintained. 不使用child
>
选择器将导致在其他一些无法维持给定顺序的地方进行不必要的设计覆盖。
You need to put commas between each class/id/element. 您需要在每个类/ id /元素之间添加逗号。
div, .form-group, .newFormRightContent {
}
.form-group, .newFormRightContent {
}
.newFormRightContent {
}
Maybe .form-group div
has some style marked with !important
in css. 也许
.form-group div
在CSS中具有某些标记为!important
样式。 Than you should try also to make your style important for your child div. 比您还应该尝试使自己的风格对孩子div重要。 eg
例如
.newFormRightContent {
background-color:#cecece!important;
}
Is this html code block inside IFrame ? 这是IFrame中的html代码块吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.