为一个div元素重置多个css样式

15 css jquery styles css-reset

我的问题是,是否有可能为单个div和该div中包含的所有元素重置css样式(很多它们).

我问,因为我发现这个教程是一个jquery shoutbox,它有自己的css文件.我不能只将样式复制到我自己的css文件中,因为它会将已经设置好样式的页面上的其余部分搞定.

我想过使用divwrapper并将所有这些重置仅应用于那个.我只是不确定是否可能

我只知道这种方式

#divwrapper td{ set styles }

@CHARSET "UTF-8";
/******* GENERAL RESET *******/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em,
font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody,
 tfoot, thead, tr, th, td {
border:0pt none;
font-family:inherit;
font-size: 100%;
font-style:inherit;
font-weight:inherit;
margin:0pt;
padding:0pt;
vertical-align:baseline;
}
Run Code Online (Sandbox Code Playgroud)

谢谢,理查德

Nol*_*rin 12

试试这个:

div.foo, div.foo *
{
    // your styles
}
Run Code Online (Sandbox Code Playgroud)

它将样式应用于div类"foo"及其所有后代.star(*)被称为通用选择器,毫不奇怪,选择任何类型的元素.

或者对于直系孩子:

div.foo, div.foo > *
{
    // your styles
}
Run Code Online (Sandbox Code Playgroud)


Spl*_*iFF 4

如果可行的话,您可以将所有内容“重置”到 iframe 中。iframe 内容不会继承任何内容。