Using shorthand properties

Using shorthand properties is one way in which the page load can be sped up. As obvious as it may sound, sometimes, we take the browser and network for granted when we are working on our cozy laptop, and we forget to take into consideration the poor 3G-based devices. So, the next time you want to style the background or border of an element, ensure that they are all collapsed and written using shorthand.

Sometimes, you may run into a situation where you want to override only one property of a certain element's style. For example, if you want to apply border on three sides of an element, use the following:

.okay {
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
} // 114 characters including spaces

.better {
border: 1px solid black;
border-top: 0;
} // 59 characters including spaces
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.134.218