可以内联CSS应用于嵌套在样式元素中的子元素吗? [英] Can inline CSS apply to child elements nested in the styled element?

查看:274
本文介绍了可以内联CSS应用于嵌套在样式元素中的子元素吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个简单的问题:


  • 我想应用样式 vertical-align:top c

  • 我必须使用内联CSS,因为我在维基上,所以我不能编辑
    外部样式表,或编辑< head> 来嵌入样式。

  • 当我向< table> 标记添加样式属性时,出现此样式不会传递到其子元素。 (我可以看到这是几乎总是一件好事。)

  • 我不能使用< style>< !-...-- < / style> ,因为这不是MediaWiki页面上允许的标签。

  • I want to apply the style vertical-align: top to every <tr> in a table, without manually applying the style to every row.
  • I have to use inline CSS because I'm on a wiki, so I can't edit the external style sheet, or edit the <head> to embed a style.
  • When I add a style attribute to a <table> tag, it appears this style is not passed on to its child elements. (I can see how this is nearly always a good thing.)
  • I can't use <style><!--...--></style>, because that is not a permitted tag on MediaWiki pages.

strong>我应该辞职给每个< tr> 添加 style =vertical-align:top 仍然是我忽略的一个解决方案?

Should I resign myself to adding style="vertical-align: top to every <tr>, or is still a solution I am overlooking?

编辑:删除一个背景信息块,以限制问题标题建议about。

Removed a lump of background info, in order to limit the question to what the question title suggests it is about.

推荐答案


可以嵌入CSS中的子元素嵌套在样式元素中吗? >

Can inline CSS apply to child elements nested in the styled element?

不直接。

间接,只有子元素 that-property:inherit 在其现有样式表中设置。

Indirectly, only if the child element has that-property: inherit set in its existing stylesheet.

这篇关于可以内联CSS应用于嵌套在样式元素中的子元素吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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