自定义html标签的默认CSS? [英] Default css for custom html tags?
问题描述
我有时会使用自定义html标记作为其他元素的容器:
I sometimes use custom html tags as containers for other elements:
<message-panel></message-panel>
像上面这样的未知元素是否具有默认样式集,这些样式在主要浏览器中是常见的?
Does an unknown element like the above have a default set of styles, common among the major browsers?
而且,是否可以为页面上的所有未知元素设置默认样式?
And, is it possible to set a default style for all unknown elements on a page?
推荐答案
All unknown elements have a computed display value of "inline" source
您可以使用
* { ... }
对于所有元素,但这意味着您也将覆盖默认元素的所有非特定设置.
for all elements, however this means that you overwrite anything non-specific set for default elements too.
最好继续使用HTML5定义的标记,除非您正在按照Web组件的方式进行操作.
It's better to keep to using HTML5 defined tags unless you're doing something along the lines of webcomponents.
这篇关于自定义html标签的默认CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!