Selectors Explained

栏目: IT技术 · 发布时间: 6年前

内容简介:Have you ever found yourself either writing a CSS selector that winds up looking confusing as heck, or seen one while reading through someone's code? That happened to me the other day.Here's what I wrote:At the end of it, I honestly couldn't even explain w

Have you ever found yourself either writing a CSS selector that winds up looking confusing as heck, or seen one while reading through someone's code? That happened to me the other day.

Here's what I wrote:

.site-footer__nav a:hover > svg ellipse:first-child { }

At the end of it, I honestly couldn't even explain what it does to myself. LOL, that probably means there was a better way to write it.

But Hugo Giraudel has this handy new tool that will explain any selector you throw at it.

Here's how it explained mine:

An <ellipse> element provided it is the first child of its parent somewhere

… within a <svg> element

… itself directly within an <a> element provided it is hovered

… itself somewhere

… within an element with class site-footer__nav .

Bravo! It even spits out the specificity of the selector to boot. 

Direct Link to ArticlePermalink

The post Selectors Explained appeared first on CSS-Tricks .


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

精通Nginx

精通Nginx

[瑞士]艾维利 / 陶利军 / 人民邮电出版社 / 2015-2 / 49.00元

Nginx是一个高性能的轻量级Web服务器,本书从配置文件的角度出发,介绍了多种关于 Nginx配置文件的技巧。 本书以模块化风格写成,几乎每一章都是一个独立的模块,读者将能够自由地在各个模块间切换阅读。全书分两部分,第一部分用8章内容介绍了安装Nginx及第三方模块、配置指南、使用mail模块、Nginx作为反向代理、反向代理高级话题、Nginx Http服务器、Nginx的开发以及故障排......一起来看看 《精通Nginx》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具