CSS Tutorial - CSS a widely used language in the world. CSS stands for Cascading Style Sheets
. 'Cascading' is a very important word. If you don't understand the concept of cascading then it may happen that CSS applied to an element doesn't work. According to developer.mozilla.org, 'Cascading' is a mechanism of selecting which CSS rule to apply to an element. Suppose you have defined two rules for the same element. Now, the cascading algorithm will choose only one and apply it to the element. For example:
In the example above, notice that we have applied two different colors to the same heading. However, the blue color is selected by the CSS Cascade algorithm. It means that the order of CSS Styles is important in case of a conflict. In this case, the property which was written later or that comes last, wins the race and gets applied.
However, the cascading algorithm is not limited to only order of appearance. There are some more rules that we will cover later in this CSS tutorial, as you won't be able to understand them right now.
The 'Style Sheets' is pretty easy to understand, we create different sheets with styling properties and use them on the website. You can create multiple Style Sheets, there is no limitation.
Now we have understood the meaning of CSS, let's see some samples of CSS properties.
CSS is a bag of beautiful properties and features. There are so many amazing properties like shadows, round corners, gradients, CSS animation, flexbox, etc. that enhance the whole website's design.
let's see some examples of CSS designs:
The CSS Shadow effect gives the HTML element a floating look. If done properly, this small feature can make websites look very attractive.
A gradient is a combination of two or more colors. In gradients, one color smoothly fades into another color, and so on.
CSS Button hover property is very popular. By CSS hover property, we can change the style of any HTML element when the cursor hovers over it.
CSS Animation is a way to add animated effects to HTML elements.
Let's see some more important aspects of why CSS is essential for a website. We have already told you many applications and features of CSS, but these points will further clarify your doubts about CSS:
reusing of code
.compatible
and readable
in all the devices like laptops, tablets, mobiles, etc. which have different screen sizes.CSS is different than HTML. One is a markup language and the other is a style sheet. So, how to integrate CSS with HTML?
HTML has a tag called <style>
tag. It is a paired tag, i.e. one opening and one closing tag, ex. <style>
CSS code</style>
. This tag embeds CSS into HTML, it is a dedicated tag for adding CSS. So, we write all the CSS within <style>
tag. On the other hand, CSS code written outside <style>
tag is just plain text for browser.
There are different ways to embed CSS with HTML according to the type of CSS. Yes, CSS has types also. But no worries, these are very simple concepts, we will get back to it later in the tutorial. Let's see our first example of CSS:
Welcome to CSS
In the example above, the <style>
tag is used to embed CSS within HTML. All the CSS should be inside <style>
tag. The selectors for a particular tag are used to give style to it. For example, h1 { }
and p { }
selectors are used for heading and paragraph respectively. Let’s see the CSS properties used:
You can try our Online editor and can do changes accordingly.
In this tutorial, till now we have given you a brief introduction to CSS. In the next CSS tutorial we will learn about CSS Syntax.
Sr.No. | Topics | Learn |
---|---|---|
1 | What is CSS | Learn |
2 | CSS Tutorial | Learn |
3 | CSS Syntax | Learn |
4 | How To Use CSS | Learn |
5 | CSS Selector | Learn |
6 | CSS Background | Learn |
7 | CSS Display | Learn |
8 | CSS Float | Learn |
9 | CSS Font | Learn |
10 | CSS Icon | Learn |
11 | CSS Link | Learn |
12 | CSS Table | Learn |
13 | CSS Line Hight | Learn |
14 | CSS Opacity | Learn |
15 | CSS Height & Width | Learn |
16 | CSS Overflow | Learn |
17 | CSS Position | Learn |
18 | CSS White Space | Learn |
19 | CSS Word Wrap | Learn |
20 | CSS Box Model | Learn |
21 | CSS Padding | Learn |
22 | CSS Margin | Learn |
23 | CSS Border | Learn |
24 | CSS Forms | Learn |
25 | HTML Bold Tag | Learn |
26 | CSS Navigation Bar | Learn |
27 | CSS Tooltip | Learn |
28 | CSS Buttons | Learn |
29 | CSS Pagination | Learn |
30 | CSS Attribute Selectors | Learn |
31 | CSS3 Drop Shadows | Learn |
32 | CSS3 2D Transforms | Learn |
33 | CSS3 3D Transforms | Learn |
34 | CSS3 Transition | Learn |
35 | CSS3 Animation | Learn |
36 | CSS3 Layout | Learn |
37 | CSS3 Filter | Learn |
38 | HTML Video Tag | learn |
Follow Us: