如何排除来自CSS具体的控制? [英] How to exclude specific control from css?

查看:160
本文介绍了如何排除来自CSS具体的控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个<一个href=\"http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/checkboxes/defaultcs.aspx?#qsf-demo-source\"相对=nofollow> Telerik的树状这在HTML呈现为 UL

I have a telerik treeview which renders in HTML as ul.

当我尝试在我的aspx具体 CSS ,它不会出现在正确的方式,因为CSS文件中有 UL 选择。

When I try it in my aspx with specific css, it doesn't appear in the correct way because the CSS file has ul and li selectors .

从萤火虫:


现在我想排除这种控制(#tabContaier UL,#tabContaier李)

Now i want to exclude this control from (#tabContaier ul ,#tabContaier Li)

我想这个问题的一些通用的解决方案尤其是与 Telerik的控制。

I want some general solution to this problem especially with the telerik controls.

编辑:

申请后级联技术:

<telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="True" Height="200px"
                                                                TriStateCheckBoxes="true"  CheckChildNodes="true" Skin="rad_rv"  EnableEmbeddedSkins="false" >

推荐答案

有几种方法可以覆盖规则,CSS,如果你不能改变的.css 文件这些规则的规定。

There are several ways to override rules in CSS if you can't change the .css file in which these rules are specified.


  1. 梯级:顾名思义,在以后的书面覆盖前面的书面规则,无论他们是在同一个表或不CSS规则

  1. Cascade: As the name implies, in CSS rules written later override rules written earlier, whether they are in the same sheet or not.

特异性:比你想与你的选择重写规则更具体。 更多关于特异性

Specificity: Be more specific than the rule you want to override with your selectors. More about specificity.

内联样式:使用属性风格编写HTML元素中的样式。这是强烈不推荐,因为你应该分开presentation和内容(这是CSS的整点);然而,这是通常的方式,当你在JavaScript覆盖它们(见下文)的东西完成。的内联样式的其实只是一个具体案件的特殊性(最强);这好像是说:我的意思的究竟这个元素这里

Inline styles: Write your styles inside the HTML element using the attribute style. This is strongly not recommended, as you should separate presentation and content (that's the whole point of CSS); however, this is the usual way things are done when you override them in javascript (see below). Inline styles are really just a particular case (the strongest) of specificity; it's like saying: "I mean exactly this element here".

使用重要 的规则后:诉诸这是压倒一切的最后手段,因为 !重要将覆盖任何东西,但用户定义的!重要标记的样式表。

Use !important after a rule: resort to this as a last means of overriding, as !important overrides anything but user-defined !important marked stylesheets.

当然,由于您使用jQuery标记你的问题,你能做到这一点与jQuery和JavaScript一般为好。但是,我没有看到,在这种情况下,你为什么会想这样做。

Of course, since you tagged your question with jQuery, you could do that with jQuery and javascript in general as well. But I don't see, in this case, why you would want to do that.

在你的情况,例如更好的级联将只是:定义 #tabContainer UL 您Telerik的样式定义它们之后。就那么简单。你什么时候导入样式表?将上面你自己的样式表,你将确保一切你会写会覆盖写了些什么那里。

In your case, example of better cascading would be just: define #tabContainer ul after your telerik stylesheet defines them. Simple as that. When do you import that stylesheet? Move it above your own stylesheet and you will be sure everything you will write will override what's written there.

的例子特异性后,将确定像 #container的#tabContainer UL 。这将覆盖更一般的 #tabContainer UL 规则。

An example of specificity, would be defining something like #container #tabContainer ul. This will override the less specific #tabContainer ul rule.

内嵌样式将意味着你居然把样式硬codeD在你的元素,像这样:

Inline style would mean that you actually put the styles hard-coded in your element, like so:

<ul class=rtUL rtLines" style="height: 40px;">

重要 适用于您要在蛮力,像这样一个规则:

Using !important works on single rules you want to brute force in, like so:

#tabContainer ul {
    height: 40px !important;
}

这篇关于如何排除来自CSS具体的控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆