官术网_书友最值得收藏!

Introduction

When coding Sass, you should realize that SCSS code compiles into valid CSS code. Sass does not guarantee that the CSS is modular, readable, or well-organized, and so easy to maintain. In this chapter, you will learn how to use nesting in your Sass code to reflect the visual hierarchy of your HTML and extend selectors to reduce the size of the compiled CSS code.

Also, the parent reference will be explained. You can use the & parent reference to use the parent selector in your code without having to explicitly use its name. The recipes in this chapter describe many useful use cases of the parent reference.

Sass does not generate bad code, but coders can. When you apply the Sass features described in this chapter, you should always keep the final result in your mind. For instance, nesting your code to follow the visual hierarchy of your HTML will make your code easier to read and maintain. On the other hand, nesting too deeply will produce overspecified CSS and will be considered to be a bad practice.

In the last recipe, you will learn about the Object-Oriented CSS (OOCSS), Scalable and Modular Architecture for CSS (SMACSS), and Block Element Modifier (BEM) methodologies. These methodologies can help you better organize your CSS code.

主站蜘蛛池模板: 获嘉县| 台湾省| 华宁县| 永年县| 宁蒗| 色达县| 永登县| 鹤岗市| 塘沽区| 闵行区| 贵溪市| 中阳县| 通道| 高陵县| 会理县| 都昌县| 交城县| 北流市| 吉水县| 宁武县| 定州市| 宜兰市| 泉州市| 收藏| 荔波县| 颍上县| 仁怀市| 仙居县| 综艺| 光山县| 沂源县| 赤水市| 奎屯市| 德州市| 恩平市| 清水河县| 桂平市| 博乐市| 牙克石市| 金山区| 桐城市|