Basic CSS-That you must need to know

CSS Tutorial: What is CSS

 CSS Tutorial: What Is CSS?

CSS stands for cascading style sheet. That helps to styling our html tags and documents. That tells the attributes how to display? This is also the type of programming language that we needs in our website to make our website better.

So let’s begin the tutorial without wasting your time.

There are three types of CSS:

  • Inline cascading style sheet
  • Internal cascading style sheet
  • External cascading style sheet

Inline Cascading style sheet:

This type of CSS is used when we write any tag of html this cascading style sheet are written in this tag like this:

<h1 style=”text-align: center; font-family: Calibri;”>



Internal Cascading style sheet:

In this type of CSS we will make the tags in html and we will design our website in only one page. The html and cascading style sheet are written on same page.




Text-align: center;

Color: brown; }


<h1> DailyKNews </h1>

That code will help us to give color to our font and take the text in center of the web page.

External Cascading style sheet:

Most of the peoples will used the external cascading style sheet. To using this type of CSS we will make the a file that extension is index.css and save this file where the html file is created. We will simple add this page URL in our html file.



Background-color: red;

Color: green;



Text-align: center;



Font-size: 20px;

Font-family: Calibri;



This is the example of external cascading style sheet that will help us to designing our body heading and also the paragraph of the website.

Types of selector:

Element selector:

This selector will select the tag that we will be written. We will just only write the name of this tag and edit this.



Color: black;

Background-color: blue;



This selector will help us to edit the color of the font and also change the background color of the font.

ID Selector:

Id selector will help us to change the style of the full block and only the line of the website we use the div with class attribute and give the id to this div. Suppose we give the name to this div is tag. The syntax of designing the tag is



Color: lightblue;

Text-align: center;



# tag indicates that this is the id of the class and this coding will help us to take the div into the center of the page and give the color to this is Light blue.

Universal Selector:

Universal selector is used to change the style of the all html we will written. It will automatically select the full page of the website and also modify it.



Text-align: center;

Color: purple;



This code is help us to take all text that we will written in our web in center. And also change the color of that font.


We will use the comments to explaining our written code that will help us to improve the readability of the programmer. And by reading this comment that are written in our coding we will easily detect the error in our CSS.

The syntax of comments is


/* heading */


We also use this syntax in our cascading style sheet code.



To give the background colors to a font or anything we use the property that is background color



Background-color: lightgreen;



This will help us to give light green color to the body of the html. We also changed the opacity height and width of the background color.

Background Image css:

We also set the picture as a background image css of the font that looks attractive than color. It will also helps the people to know that what we will provide to others.

The syntax of use the image as a background image css.



Background-image: url(“pic.jpg”);



By using this syntax we will able to add image as a background. We also optimize the opacity of the image.

Border CSS:

We will also add the border css around the text there are different types of border.

Dotted: that helps to make border in dot shaped around the font.

Dashed: that helps to make dashed shaped border.

Solid: that helps us to make solid border around the text.

Double: that helps us to make double border around the text.

None: that displays no border around the text.

Hidden: that will hide the border around the text.

To writing this types of border css we will use this syntax.



border-style: dashed;



This syntax will help us to make the border around the text in dashed shaped. We will also make the border css round and also add colors and width in the border.


Margin will helps us to give spacing outside the border there are four types of margin. That is top, marg bottom, it left and margin right that are help us to give spacing from different sides.

The syntax of margin is:



Margin-top: 80px;

Margin-bottom: 70px;

Margin-left: 90px;

Margin-right: 50px;



That will help us to give spaces around the text border and we will give different spacing using pixels (px) and also percentage (%).


Padding is to give the spaces between the border and the text. If we will make the border around the text and give padding we use this syntax:



Padding-top: 10%;

Padding-bottom: 30%;

Padding-left: 20%;

Padding-right: 50%;



That will help us to make different width and length space between the text and the border and it will also look attractive.

CSS Icon:

Icon is very important in our website javascript will help us to give the icons in our website easy. We will just simply add the link of the javascript and give the built-in CSScodes in our style sheet.

The syntax of adding the icons in our website is:




<script src=”url of javascript” crossorigin=”anonymous”></script>



<i class=”fas fa-cloud”></i>

<i class=”fas fa-heart”></i>

<i class=”fas fa-bus”></i>

<i class=”fas fa-file”></i>

<i class=”fas fa-bars”></i>




This code will help us to add icons in our website. In this code we will add the cloud, heart, bus, file and bars icon. If we will not add the icons java script link in our website we will create the icons manually that is difficult for us.

In this article we will tell you about the basics of cascading style sheet. In the next article we will tell you about the advance cascading style sheet that we will need to know.

For more information visit to this website.

For read the course of html visit to our website.

What is HTML Previous post What is html-Here is the advance Html tags that we used
CSS Advanced Next post CSS Advanced-That make you a web designer

Leave a Reply

Your email address will not be published. Required fields are marked *