- 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.
- 潮流:UI設計必修課
- 跟老齊學Python:輕松入門
- C語言程序設計教程(第2版)
- Blender 3D Incredible Machines
- 機器學習與R語言實戰
- Scala Reactive Programming
- Mastering Data Mining with Python:Find patterns hidden in your data
- Django 3.0入門與實踐
- Learning Android Application Testing
- Android Studio開發實戰:從零基礎到App上線 (移動開發叢書)
- Mastering ASP.NET Core 2.0
- Visual FoxPro程序設計習題及實驗指導
- Android熱門應用開發詳解
- 趣味掌控板編程
- ASP.NET 3.5系統開發精髓