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

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.

主站蜘蛛池模板: 嵊泗县| 奉新县| 固原市| 澄江县| 永春县| 来凤县| 游戏| 南靖县| 错那县| 阿勒泰市| 灵寿县| 福州市| 确山县| 周口市| 道真| 嘉义县| 南投县| 江永县| 徐州市| 丰宁| 宁陵县| 迁安市| 黔西县| 汕头市| 河北区| 伊金霍洛旗| 临颍县| 阳曲县| 茶陵县| 五原县| 隆昌县| 庆城县| 库车县| 读书| 阿荣旗| 南宁市| 西平县| 芒康县| 南陵县| 休宁县| 道真|