In this series you will learn property-wise. The last stop in the journey of this series is Creating Responsive Site. So please go through with all futures CSS articles. Before starting the series first we will look at the answers to some basic questions.
- What is CSS?
- Which IDE(Integrated Development Environment) Required?
- How to create a CSS file & Types of CSS?
- How to link External CSS file to HTML?
- What is Property?
- Basic Rules of Writing CSS & CSS Selector
- Online formatter.
- CSS properties Explanation and Practical
- Background
- Border
- Float
What is CSS?
CSS stand for Cascading Style Sheets. This very simple language is used to decorate and make beautification and make stylish web page. Without CSS web page will not look good.
If a Web Page isa human body then HTML is like a skeleton and CSS is like the actual body.
Simple Web Page Web Page with CSS

CSS makes web pages look stylish. Mostly visitors look at your website design, way of presentation and colors, dimension of object etc….
This can all be achieved by CSS.
Which IDE(Integrated Development Environment) Is Required?
You can use any normal notepad application to write HTML and CSS. Because CSS is not required to compile, it's just a text file.
To the best of my knowledge you can use the following IDE:
- Visual Studio Community Edition
- Visual Studio Code
- NetBeans
- Brackets
- SubLimeText
For more detail you can Google the following keywords ”free html css ide”
Or
https://www.google.co.in/search?source=hp&ei=Yq8mWsizLYSSvQSyh5DwCA&q=ree+html+css+ide&oq=ree+html+css+ide&gs_l=psy-ab.3..0i13k1j0i22i30k1l3.7651.7651.0.8026.1.1.0.0.0.0.140.140.0j1.1.0....0...1c.1.64.psy-ab..0.1.139....0.CG91BYfxBgU
How to create a CSS file & Types of CSS?
CSS file is a plain text file you can even create it in a simple notepad program.
There are three ways to use css in html documents.
- In Document Style / Internal Style Sheet
- Inline (With Html Tag)
- External Style Sheet
These three ways can be used in one document. Its depends upon developer to developer and project / situation.
In Document Style
Under head tag section mostly we write a style tag that is In Document Style.
- <head>
- <style>
- IN DOCUMENT STYLE
- </style>
- </head>
Example
- <head>
- <style>
- p {
- background: green
- }
- ;
- </style>
- </head>
Inline Style
With html tag we write Inline style.
- <p style=”Inline Style”>This paragraph tag and text</p>
Example
- <p style=”background:red”>This paragraph tag and text</p>
Performance
External CSS file is the best option to use in html documents because it reduces the loading time of the page.
Inline CSS makes it slightly slower to load html documents.
Online Test CSS performance link
https://jsperf.com/inline-style-vs-css-class/2
How to link External CSS file to HTML?
You can bind CSS files in header <head> section of HTML document.
Example
<link href="css/style.css" type="text/css" rel="stylesheet" />
In the above example you can see STYLE.CSS file which located inside CSS folder and linked with html document.
What is Property?
CSS is all about properties. Property is one type of predefined option which can be set by different values.
In the example you can see background color property option which can be set by different colors as per your web page requirement.
Example
background-color: yellow;
Above property will make a yellow background color where its get declared.
Basic Rules of Writing CSS
; : Semicomma is line terminator.
{ } : Inside curly braces we write the css style for In document (Internal) )style and External Style Sheet.
/* */ : Single line and Multiline can be marked as comments.
CSS Selector
You can write css on a selector basis. Following is a type of selector,

- ID wise
- Tag wise
- Class wise
- Group Tag wise
ID wise
As you know CSS for HTML and CSS bind to html tag. In html tag you mostly define ID attribute.
In following example you can see P tag defined with id named intropara
Example
<p id=”intropara”>Welcome to learn CSS</p>
We write css for defined ID.
Example
- #intropara {
- text - align: justify;
- }
Tag wise
We write HTML with the help of Tags like this:
<p> <h1> etc..
- p {
- background - color: yellow;
- }
- h1 {
- font - style: italic;
- }
As per above, tag wise style means background color will be yellow to all p tags and all H1 tag will be displayed in italic form.
Class wise
Classwise style sheet are mostly used in HTML and CSS because you can give one class name to multiple tags. Class wise css start with . (dot).
Class HTML example,
- <p id=”firstpara” class=”italicletter”>This paragraph number 1</p>
- <p id=”secondpara” class=”italicletter”>This paragraph number 2</p>
CSS example,
- .italicletter {
- font - style: italic;
- }
Group Tag wise
Groupwise tag css style is where we write css rules for multiple html tags.
In the following example you can see style sheet rules written for h1 and p tags.
Example
- h1, p {
- font - style: italic;
- }
Online CSS Formatter
You can format and align your css code online on the following sites,
- https://www.cleancss.com/css-beautify/
- https://www.freeformatter.com/css-beautifier.html
- http://www.codebeautifier.com
CSS properties Explanation and Practical
- Background
- Border
- Content
- Float
Background
CSS background property to set the background things of HTML element.
Background has the following types of properties,
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
- background-color:
To set the background color of a html element.
You can specify the color by following ways,
- Color Name
- Hex Values
- RGB numers.
Syntax
background-color: <color name>;
Example
background-color: red;
- background-image
To set the background image of a html element.
Syntax
background-image: url / path
Example
background-image: “images/pic.jpg”;
- background-repeat
To set background if image will repeat on page or not.
Syntax
background-repeat: repeat/repeat-x/repeat-y/no-repeat/
Example
background-repeat: repeat-x;
- background-attachment
This property is to set background image scrollable with image or without image.
Syntax
background-attachment: scroll / fixed / local / initial / inherit
Example
background-attachment: scroll;
- background-position
To set the position of the image
Syntax
background-position: left / left top / left center / left bottom / right top / right / right center / right bottom /
center / center top / center center / center bottom
Example
background-position: left;
Border
To set the border. Border having following sub categories properties.
- border: All in one property to set the all types border rules.
Syntax
border: <width> <style> <color>
Example
border: 7px dotted blue;
You will learn more about border-width, border-style and border-color in coming paragraphs.
- border-bottom : To set bottom side border.
Syntax
border-bottom: <bottom width> <bottom style> <bottom color>
Example
border-bottom: 7px dotted blue;
Border bottom can be further divided or extended into the following properties
- border-bottom-color
- border-bottom-style
- border-bottom-width
- border-bottom-left-radius
- border-bottom-right-radius
- border-bottom-color : To set the bottom border color.
Syntax
border-bottom-color: <color name>
Example
border-bottom-color: red;
- border-bottom-style : To set the bottom border style.
Syntax
border-bottom-style: <none/dotted/solid/double/groove/ridge/inset/outset>
Example
border-bottom-style: dotted;
- border-bottom-width: To set the bottom border width
Syntax
border-bottom-style: <thin/thick/??px>
Example
border-bottom-style: 10px;
- border-bottom-left-radius: To make left bottom in round corner shape.
Syntax
border-bottom-left-radius: <length/%>
Example
border-bottom-left-radius: 10px;
border-bottom-left-radius: 10%;
- border-bottom-right-radius:To make right bottom in round corner shape.
Syntax
border-bottom-right-radius: <length/%>
Example
border-bottom-right-radius: 10px;;
border-bottom-right-radius: 10%;
- border-top: To set top side border.
Syntax
border-top: <width> <style> <color>
Example
border-top: 7px dotted blue;
Border top can be further divided or extended into the following properties:
- border-top-color
- border-top-style
- border-top-width
- border-top-left-radius
- border-top-right-radius
NOTE
You can set border-top-<properties> in a similar way as border-bottom-<properties>
- border-left: To set left side border.
Syntax




Arvind SinghPosted Jan 3, 2018, 11:32 PM
Nice article........