2

我有一个 html 编辑器(ckeditor)。我可以用它轻松腾出空间给我那个代码

我在这段代码上方有一些 css,它破坏了我的第一行 ckeditor。所以 cellpadding 没用,这不是我要找的

我尝试了一个没有成功的类 nostyle(在我的帖子末尾)

<div class='nostyle'>
<p>my title</p>
<!--- beginning of ckeditor source --!>
<table align="center" border="1" cellpadding="10" cellspacing="10" style="margin:100px; padding:100px">
<tbody>
<tr>
<td style="vertical-align:bottom"><img alt="" src="box4m3.png" style="height:147px; width:146px" /></td>
<td style="vertical-align:bottom"><img alt="" src="box8m3.png" style="height:200px; width:199px" /></td>
<td style="vertical-align:bottom"><img alt="" src="box12m3.png" style="height:250px; width:248px" /></td>
</tr>
</table>
<!--- end of ckeditor source --!>   

没有样式的CSS:

.nostyle{
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
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, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
}.nostyle{
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
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, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
}
4

1 回答 1

2

这是不可能的。

规范要求,当 HTML 表示规则和 CSS 规则发生冲突时,CSS 将始终获胜。

UA 可以选择尊重 HTML 源文档中的表示属性。如果是这样,这些属性将被转换为特定性等于 0 的相应 CSS 规则,并被视为插入到作者样式表的开头。因此,它们可能会被后续样式表规则覆盖。在过渡阶段,此策略将使样式属性更容易与样式表共存。

nostyle.csstd为和元素定义填充th,所以它总是会覆盖一个cellpadding属性。

于 2015-03-14T09:33:02.243 回答