html - css 不覆盖表格 cellpadding ='10'

标签 html css cellpadding

我有一个 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;
}
}

最佳答案

这是不可能的。

specification要求比当 HTML 表示规则和 CSS 规则发生冲突时,CSS 总是获胜。

The UA may choose to honor presentational attributes in an HTML source document. If so, these attributes are translated to the corresponding CSS rules with specificity equal to 0, and are treated as if they were inserted at the start of the author style sheet. They may therefore be overridden by subsequent style sheet rules. In a transition phase, this policy will make it easier for stylistic attributes to coexist with style sheets.

nostyle.css 定义 tdth 元素的填充,因此它始终会覆盖 cellpadding 属性.

关于html - css 不覆盖表格 cellpadding ='10',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29046989/

相关文章:

css - Bootstrap 4 & 全高页面上的 flex 和可折叠内容

HTML/CSS 格式 : TRUE spacing between cell <-> cell, 不在单元格 <-> 之间

php - 使用数据库中的数据预设表单的值

HTML/CSS - 不会消失的神秘顶部填充

html - 文字装饰 :none formatting not working when sending HTML emails with Outlook 2007

html - 无法删除图像上的填充

javascript - Jquery 使切换和替换多个元素

javascript - 使用 javascript 存储动态内容时出现未终止的字符串文字错误

css - Bootstrap 4.0 自定义汉堡图标