CSS Tips and Tricks: Part 2 of 6

What is CSS3?


Disclaimer: This series of CSS Tips and Tricks will assume you have at least an intermediate level understanding of HTML and CSS.

In the first installation, we outlined display:none; - what it is, why to use it, and how to use it. Next, we’re going to talk about Cascading Style Sheets 3 (CSS3).

CSS3 is a wonderful computer language that can be used to give a better shape to your website. Though the CSS3 language is not terribly complicated, certain new advanced features can be confusing. If you’re not familiar with said features then you may find CSS3 a bit difficult, but let’s see if we can help. If you would like to be a CSS3 specialist or even if you just want to be more familiar with it, here are some tips that can help you to reach your goal.

How centering in CSS can help you to understand CSS3 transformation. Some people find it difficult to deal with centering items in CSS. In fact, they cannot track the centering problem of a web design. This is a very simple procedure and one can easily track this with a little help. Usually, designers try to use perfect positioning so that the elements will be rightly centered, but if you want to choose vertical centering, it’s better to go for CSS3 transform.

Container drive is required for providing an absolute position. However, vertical centering can also be achieved by auto-adjusting through the use of CSS3 transform. You just need to follow some procedures:

                          Go to the div. container, keeping the position relative

                          then go to the div container p, keeping the margin 0

                          make the position absolute, keeping the top 50 %

                          and then go for CSS3 transform

This works exceptionally well for animation since CSS transform is able to apply several visual effects to the elements such as rotate, move, and skew, among others.

Get acquainted with CSS3 specificity. Not everyone is acquainted with the word specificity. This is a basic idea and anyone who wants to be a CSS3 expert must need to be acquainted with this word. Specificity makes the browser choose the appropriate property values to an element and gets them applied through the browser. But the problem of the specificity is that it limits CSS rules to some elements only.

To resolve the problem, you just need to know some specificity rules. For example, ID selectors contain more specificity than attributive selectors. Rules getting more specific selectors will enjoy greater specificity, and override previous and conflicting rules. If you’re still facing specificity problems, then make sure that you are not using the important declaration button and give more effort to use fewer selectors for styling an element and place your style in LVHA order.

Prefer HSL over RGB. Most of the people choose the old RGB hex tag system for the specification of the colors. In the first impression, it looks good as it is specified with different colors like black, red, and blue separately. This RGB system is fine if you’re not working with color controls that require complementary and contrasting shades with similar saturations. In that situation, you'll want to choose HSL in order to get several conversions. And the process will be easy since CSS3 supports HSL color specificity.

Hopefully this has provided a little help to anyone who wants to start using CSS3. Stop back next week for a discussion on the benefits of using CSS syntax for web design.

Posted on August 21, 2015 and filed under CSS Tips and Tricks.