Selectors Explained

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

内容简介: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 .


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

查看所有标签

猜你喜欢:

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

深入浅出Ajax

深入浅出Ajax

(美)Brett McLaughlin / 东南大学出版社 / 2006-5 / 98.00元

本书将教会您如何在很短的时间内掌握使用JavaScript代码来向服务器提交异步请求?同时,您可以学习如何使用诸如动态HTML、XML、JSON、DOM等技术来解决开发过程中遇到的许多问题。让你从那些繁琐而笨拙的网站开发技术中彻底解放出来!本书将是一本指导您进行异步开发的经典参考书籍。   作为一名网站设计人员,您也许时常因为遇到以下情况而烦恼:用户只是移动了鼠标就要从服务器重载数据......一起来看看 《深入浅出Ajax》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具