如何在 Angular 2/5 中的自定义标签上应用 CSS? [英] How to apply CSS on custom tag in Angular 2/5?

查看:18
本文介绍了如何在 Angular 2/5 中的自定义标签上应用 CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 Google ReCaptcha (ng-recaptcha) 组件安装到我的应用程序,并想知道是否有办法将某些样式应用于生成的子元素,在我的情况下,元素.

I've installed the Google ReCaptcha (ng-recaptcha) component to my app, and was wondering if there is a way to apply some styles to children elements of the generated, in my case, <re-captcha></re-captcha> element.

例如:

re-captcha{
    border: 1px solid #ccc; /*works*/
}

re-captcha div{
    border: 1px solid #ccc; /*doesn't work*/
} 

能否请您分享一些实现预期结果的经验?

Could you please share some experience of achieving the desired result?

更新:

但是,如果直接在 DevTools 中设置,以下工作...

The following works however, if set directly in DevTools...

re-captcha div{
    border: 1px solid #ccc; 
} 

推荐答案

试试下面的代码片段:

re-captcha /deep/ div{
    border: 1px solid #ccc;
} 

这篇关于如何在 Angular 2/5 中的自定义标签上应用 CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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