Eleven Tips for Working with CSS (Cascading Style Sheets)

Introduction

No matter whether you are a beginner in the area or has already developed several sites: at this point, you already tired of knowing that the external style sheets(CSS – Cascading Style Sheets) are binding in any project. Fortunately, this feature can be used with some simple tips to facilitate our work. See 11 of them the following!

1 – div1 is different from the menu

Avoid giving names such as div1, div2, div3 to its elements. They don’t explain anything and at the time of maintenance will make your work slower. In the same way, barra_azul not makes a lot of sense: and if you change the color of the site? Prefer names explanatory, such as menu or barra_links.

2 – Uppercase and lowercase

Names of elements make a difference between uppercase letters case: BarraLinks is different from barralinks. Pay attention at the time to use your element in the HTML.

3 – id x class

For elements that appear only once in the layout (menu, footer, header, etc) prefer the statement id, preceded by by a signal # (like #menu). For elements that will appear several times, use the statement class, preceded by by a dot (such as .news).

4 – Share claims between various elements common

5 – Remember the hierarchy and organize

To be a style sheet in the cascade, the last statement it is the one that prevails. Pay attention to not declare an element twice: at the time of maintenance, you can make the change in the first and if you ask me because it does not work, when in fact a second statement is lost in the middle of your code (for this organization it is crucial!).

6 – Comment the codes advanced

When you use CSS for more advanced, as a menu in tabs, comment your code so you don’t forget what each part of it does:

7 – make a Note of your color

#09F , or #F09, which is pink and which is blue? Even if you to be able to do calculations of RGB head to know the darkness color without a table hexadecimal color, econonize time noting the corresponding color each code in your file:

8 – Declare the units

When working with values different from zero, declare the units (px, pt, etc.). Each browser assumes a default unit when it is not specified, generating different results in each browser.

9 – make sure that the desired effect works on all browsers

Scroll bars colored (fortunately, already in the past), divs semi-transparent… this is All very cute, but may not work in all browsers. Design your site in a attractive way avoiding to exaggerate in the decorations, and, again, make sure that your CSS has the same effect on the largest number browsers as possible.

10 – do Not rely on your memory

With time, it is natural that decoremos the main elements and their attributes. Even so, always have a quick reference guide at your fingertips, to ask questions about the functioning of them. A great book that I use and recommend is the CSS – Cascading Style Sheets – Quick reference Guide, Luis Gustavo Amaral.

11 – get inspired

Sites like the css Zen Garden and the Churchcode they are great to have an idea of the new trends.Visit these and other addresses on a regular basis is recommended.

Eleven Tips for Working with CSS (Cascading Style Sheets) 1

Eleven Tips for Working with CSS (Cascading Style Sheets)
Rate this post

You may also like...