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

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.

主站蜘蛛池模板: 岳池县| 金华市| 杭锦后旗| 大厂| 普兰县| 哈巴河县| 温州市| 漾濞| 新丰县| 宿迁市| 保山市| 长汀县| 鄂州市| 太原市| 巴青县| 金乡县| 徐水县| 武鸣县| 延庆县| 栾城县| 英超| 三明市| 彝良县| 新巴尔虎右旗| 翁源县| 清苑县| 富裕县| 阿勒泰市| 阿坝| 四平市| 灵寿县| 堆龙德庆县| 杂多县| 博野县| 呈贡县| 临桂县| 万年县| 安达市| 吉木萨尔县| 昂仁县| 祥云县|