<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Selector on Commentary of Takao</title><link>https://takao.blog/zh/tags/selector/</link><description>Recent content in Selector on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>zh</language><copyright>Commentary of Takao</copyright><lastBuildDate>Wed, 15 Jul 2026 22:01:08 +0900</lastBuildDate><atom:link href="https://takao.blog/zh/tags/selector/index.xml" rel="self" type="application/rss+xml"/><item><title>带有父选择器的创意 CSS 食谱：has()</title><link>https://takao.blog/zh/web/css-has-pseudo-selector-recipes/</link><pubDate>Tue, 10 Mar 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/css-has-pseudo-selector-recipes/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/css-has-pseudo-selector-recipes-zh.png" alt="Featured image of post 带有父选择器的创意 CSS 食谱：has()" /&gt;&lt;h2 id="带有父选择器的创意-css-食谱-has"&gt;带有父选择器的创意 CSS 食谱 &lt;code&gt;:has()&lt;/code&gt;
&lt;/h2&gt;&lt;p&gt;多年来，CSS 开发人员梦想着一个 &lt;strong&gt;父选择器&lt;/strong&gt; — 一种根据子元素设置元素样式的方法。 JavaScript 和额外的类名是唯一的解决方法。然后是 &lt;code&gt;:has()&lt;/code&gt;，这个 CSS 伪类最终使“如果这个元素包含 X，则相应地设计它的样式”成为本机现实。&lt;/p&gt;</description></item></channel></rss>