New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css] 第34天 浏览器是怎样判断元素是否和某个CSS选择器匹配? #123
Labels
css
css
Comments
学到了,也就是说是从右往左匹配 |
上面老哥说的已经很完美了,简单来说就是浏览器对于 CSS 的匹配规则是从右往左进行匹配,这样的的话浏览器的寻找效率会比较高。 |
把上面帅哥的话自己说一下 一段CSS选择器,从右到左依次去html里面找,从最开始匹配的元素集合,根据增加的选择器来剔除,得到最终匹配 |
一段CSS选择器,从右到左依次去html里面找,从最开始匹配的元素集合,根据增加的选择器来剔除,得到最终匹配 |
比如说找到匹配的class为“box1”的css,就会先找到所有的含有class=box1的css选择器,再从右到左去检查它的祖先元素路径是否匹配,如果完全匹配就说明配对成功。 |
先产生集合,再从后向前判断 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第34天 浏览器是怎样判断元素是否和某个CSS选择器匹配?
The text was updated successfully, but these errors were encountered: