最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to select the descendant of a html part in CSS? - Stack Overflow

programmeradmin5浏览0评论

I am trying to style Ionic Framework's toast control. I am still learning about HTML shadow roots and templates and parts. But, as far as I have understood, it seems Ionic is using HTML templates and slots.

Now, the ion-toast element has a CSS Shadow Part called message. If I write following css, it will make the whole message element of the toast to have red background, proving the ::part css selector works.

ion-toast::part(message) {
    background-color: red;
}

What I am trying to do is color the links inside the message part. How I assume the css should work in this case is:

ion-toast::part(message) a {
  color: red;
}

But, the links are not colored. The descendant selector on parts does not seem to work. How can I target the descendants of a part in css?

This selector ion-toast::part(message)::first-letter colors the first letter of the message. So, pseudo-selectors seem to work.

发布评论

评论列表(0)

  1. 暂无评论