【问题标题】:css not to overwite table cellpadding='10'css 不覆盖表格 cellpadding='10'
【发布时间】:2017-07-15 12:45:33
【问题描述】:

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

nostyle 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;
}
}

【问题讨论】:

  • 我不确定您要做什么,但您是否尝试过使用边距?如果您使用空格,它可能会很有用。
  • @A.Abramov — 边距不适用于具有表格显示类型的元素。
  • 您的文件 nostyle 是在 CSS 中还是在 SASS/LESS 中?因为你不能在 CSS 中做.nostyle { table {}}
  • 在你的标题中,你是指Override还是Overwrite

标签: html css cellpadding


【解决方案1】:

这是不可能的。

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

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

nostyle.csstdth 元素定义填充,因此它总是会覆盖 cellpadding 属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多