#1 – What is CSS?
CSS stands for “Cascading Style Sheets” and represents a design language that helps HTML websites to get the web pages presentable. This means it has an important effect on the visual part of the websites.
CSS is really easy to learn and use. There are tons of materials in the web on how to achieve specific visual aspects with CSS.
Using CSS, you can control almost every visual aspect of your HTML presentation: the color of your text, the style of fonts, the spacing between paragraphs, background colors, borders, etc.
CSS allows you to build visually-rich websites. So, if you ever wish to change your website drastically, then sometimes even one line of CSS might do the trick.
#2 – How does CSS work?
I assume you have played around with HTML a bit. HTML allows you to assign different classes and ids to different elements. Those classes allow CSS to easily select HTML elements and assign the style to those. A typical example would be something like this:
The code above creates a new HTML div container and sets its background color to black (#000).
There are 3 ways to apply a CSS code to HTML:
- inline styling. CSS is written directly into the element:
<div style="background-color: #000;"></div>
- internal styling. CSS is added to the
styletag in the document’s
- external styling. CSS is written into the CSS file and included in the HTML file.
<link rel="stylesheet" href="my-styles.css">
Browsers understand all of those ways and easily display a div element with a black background. While HTML describes the layout, CSS describes how that layout should visually be presented.
#3 – How can CSS help us?
There is one big point here. CSS controls how we see elements on websites. Every beautiful and less beautiful site uses CSS in some way.
Even if you use a website builder like Wix or Weebly or even WordPress, then it is important to know that those use CSS as well it is just handled behind the scenes. To create a perfect website you must know CSS, there is no way around it.
#4 Tips on how to use CSS efficiently for your web pages.
The most important thing here is the structure. You should always structure your HTML and CSS to be reusable, meaning that to similar block you should give the same classes and so on. And always use external CSS, because it gives you separation and reusability.
You can play with CSS of other pages in the developer tools as well. Right-click on the website and press inspect, the CSS will be on the right part of your screen.