Global CSS for an app with web components

旧巷老猫 提交于 2019-12-24 00:15:00

问题


I'm developing a web application that uses HTML 5 native web components. My problem is that I have a lot of common CSS for all of these and I use font awesome to have nice icons. Right now I put all my styles inside "/deep" shadow piercing but Chrome says : "/deep/ combinator is deprecated." Do you have any suggestions on how can I have global CSS and CSS libraries (like font awesome) available on the whole app ?

Thanks :)


回答1:


You could include the CSS font file globally, with the <link rel="stylesheet"> element.

That you'll have to import it locally in every Custom Element's <template>, in a <style> element, using the @import url CSS rule.

There's a running example in this answer.



来源:https://stackoverflow.com/questions/38523052/global-css-for-an-app-with-web-components

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!