04.07.2019 Views

frontend-developer-1

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Use LESS/CSS to Customize the Magento Look and Feel<br />

This is compiled into:<br />

.element-selector {<br />

background-color: #ff0000;<br />

}<br />

@media screen (min-width: 750px) {<br />

.element-selector {<br />

background-color: #0000dd;<br />

}<br />

}<br />

While nesting can appear very helpful, it can introduce tremendous bloat into<br />

styling. It seems to fix specificity problems but adds many extra bytes. The question<br />

that we ask is: “are the additional selectors necessary?” In many cases they are not.<br />

Small changes to deeply nested selectors can have significant impact on output.<br />

For instance, adding a comma and second class name to a selector five levels deep<br />

doubles the entire chain. Deep nesting also leads to hard to manage selectors that<br />

are more specific than required and difficult to override. Instead, using a quality<br />

naming convention, such as BEM will eliminate many levels of nesting and simplify<br />

code reuse.<br />

Copyright © 2018, SwiftOtter, Inc.<br />

110

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!