introduction to CSS

“The aim of art is to represent not the outward appearance of thing, but their inward significance” Aristotle

G:hackHTMLmyCSS-Tutorial�1- introduction to CSS�1.jpg

CSS stands for Cascading Style Sheets

We use HTML to create elements within a webpage and CSS to change the appearance of those elements in order to create a better User Interface and at the end give users a better experience!

Just to name a few capabilities of CSS:

If we want to change the font size of a text within a page, we use CSS.

If we want to increase or decrease the space between two elements, we use CSS.

If we want to put two or more elements on top of each other, we use CSS.

If we want to change the style of a paragraph, we use CSS.

If we want to change the color of a text, we use CSS.

If we want to create a dropdown list, we use CSS.

If we want to change the position of an HTML element, we use CSS.

If we want to add image to the background of an element, we use CSS.

If we want to change the background color of an element, we use CSS.

CSS gives us the tools that we can use in order to access any HTML element within a page and style it in any taste we like.

If CSS could talk, it would say something like, “Hey browser, make this element looks like that”

Here’s some famous websites before and after using CSS:

Google without CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSgoogle-html.jpg

Google with CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSgoogle-css.jpg

Facebook without CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSfacebook-html.jpg

Facebook with CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSfacebook-css.jpg

Instagram without CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSinstagram-html.jpg

Instagram with CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSinstagram-css.jpg

Twitter without CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSStwitter-html.jpg

Twitter with CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSStwitter-css.jpg

Amazon without CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSamazon-html.jpg

Amazon with CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSamazon-css.jpg

Yahoo without CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSyahoo-html.jpg

Yahoo with CSS:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSyahoo-css.jpg

Now you can see why CSS is a styling language.

The key to learn CSS is to always remember the fact that there’s an invisible border around each HTML element. (you’ll see why as we progress along this tutorial)

G:hackHTMLmyCSS-Tutorial�1- introduction to CSS�2.jpg

We can visible this border with the help of CSS as you’ll see how to do it later in this tutorial.

Now take a look at the picture below:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSS�3.jpg

This picture shows a template webpage with visible borders around each element of the page. As you can see, every element has its own border.

Let’s see a few famous websites with and without visible border for each HTML element in those websites.

Google without visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersgoogle-invisible-borders.jpg

Google with visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersgoogle-visible-borders.jpg

Amazon without visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersamazon-invisible-borders-top.jpgG:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersamazon-invisible-border-down.jpgG:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersamazon-invisible-borders-middle.jpg

Amazon with visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersamazon-visible-borders-top.jpgG:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersamazon-visible-borders-down.jpgG:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersamazon-visible-borders-middle.jpg

Twitter without visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSborderstwitter-invisible-borders.jpg

Twitter with visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSborderstwitter-visible-borders.jpg

Yahoo without visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersyahoo-invisible-borders.jpg

Yahoo with visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersyahoo-visible-borders.jpg

Instagram without visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersinstagram-invisible-borders.jpg

Instagram with visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersinstagram-visible-borders.jpg

Facebook without visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersfacebook-invisible-borders.jpg

Facebook with visible borders:

G:hackHTMLmyCSS-Tutorial�1- introduction to CSSbordersfacebook-visible-borders.jpg

As you can see, each HTML element in a webpage has its own border.

Basically each element is represented within this boundary and most of CSS properties related to an element will be applied within the boundary.

Granted, That we have other CSS properties like margin and outline etc. that applies to outside the boundary of an element, the majority of CSS properties is focused within this boundary.

Note: We’re assuming you already know what HTML is and are comfortable with it. If you don’t, you can learn HTML easily in HTML tutorial section.