What is CSS?
CSS or Cascading Style Sheets is a language responsible for controlling the presentation of content and layout of a web page. It was developed by World Wide Consortium(W3C) with the initial release on 17th,January,1997.
CSS can be used to control how the document is presented on desktop, mobile, projector and even in print. It gives the designer the freedom to control the colour of the characters, background of parts or whole document. With CSS you can also add animations to a web page.
CSS is a rule-based language. You define the rule by specifying a group of styles to be applied to a particular element. For example, if you want to the colour a paragraph to be red and the font size to be sixteen pixel(16px), you use a code like one below:
Simple, right! That's all you have to do in CSS.
Now let break down the code above:
- p in the code above is called a selector. It selects the HTML element you want to style. In this case, we are styling a paragraph which is represented by HTML tag <P>
- We then add a set of curly brackets
- Inside the curly brackets you add one or more properties and their values in a property-value pair separated by a colon. In our case, we have two property-value pairs
- Each property-value pair is ended with a semicolon. A semicolon is used to separate one rule from another and must be added after each rule as long as it's not the last one or the only one.
Each CSS property has allowable values. In our example above, the property color can be any colour written in word, or hexadecimal like #f2f2f2 or RGB colours or HSL colours. Please note the colour names should be the predefined/Cross-browser colour names. And the property font-size in our example has the value 16px; this can be any number with CSS unit. You can learn more CSS unit at MDN.
CSS helps to bring beauty to a web page. To learn more about the great technology visit MDN at https://developer.mozilla.org/en-US/docs/Learn/CSS and W3Schools at https://www.w3schools.com/css/default.asp