- Mastering CSS
- Rich Finelli
- 153字
- 2021-07-08 09:45:53
Descendant selectors
Renaming elements with classes, as you learned in the previous section, is an extremely powerful feature in CSS. However, that's not the only way to target a specific type of element. Descendant selectors will allow you to target elements on a page based on their ancestor elements. This is often necessary because you only want to apply a margin or a new font based on the context of the element. You can use a descendant selector to get that context without putting a class on every element every time you want to target it. I'm going to first explain what parent, sibling, and child elements are as well as what ancestor and descendant elements are. We'll need to be clear about these if we want to use descendant selectors. We'll follow this up by using a practical example of the descendant selector and finishing up by calculating the descendant selector's weight.
- VMware View Security Essentials
- iOS 9 Game Development Essentials
- Java Web基礎(chǔ)與實(shí)例教程(第2版·微課版)
- Practical Data Science Cookbook(Second Edition)
- Learning RabbitMQ
- Java設(shè)計(jì)模式及實(shí)踐
- Python算法詳解
- Programming with CodeIgniterMVC
- Odoo 10 Implementation Cookbook
- Regression Analysis with Python
- Python程序設(shè)計(jì)與算法基礎(chǔ)教程(第2版)(微課版)
- Android應(yīng)用開發(fā)實(shí)戰(zhàn)
- Windows Phone 8 Game Development
- Scala Functional Programming Patterns
- Processing開發(fā)實(shí)戰(zhàn)