Basic concepts of CSS

Css :-

Css is a language that describes the style of an HTML document. Css describes how to HTML elements should be displayed , is a simply designed language intended to simplify the process making web -pages presentable.

  • CSS stands for Cascading Style Sheets. CSS allows you to apply styles to web pages. 

  • More importantly CSS enables you to do this independent of the HTML that makes up each web-page.

  • CSS control the layout of multiple web-pages all at once. It save a lot of work.

# Types of  CSS with their Syntax 

Move to types of CSS ,so there are Three types of CSS;
  • Inline CSS 

  • Internal or Embedded CSS

  • External CSS

# Inline CSS :-

Inline CSS applied directly to HTML elements  using the Style attribute.

For example :- 


Output is : 


Output is :

# Internal or Embedded CSS :-
 
When using Internal CSS , we must add a new tag ,<style> , inside the <head> tag.

For example :- 
 

Output is : 
# External CSS  :-

  • External CSS should not contain any HTML tags. It is used to apply CSS as on multiple pages.

  • Work with  External CSS , you need to take two files:- an HTML file and a CSS file.

 1.  Create the CSS file :- create a file using any text editor and save it with ( .css ) extension (like., style.css).
This file should contain CSS elements or rules only .

Example:- style.css file :-



 2.  Link this CSS file to the HTML file :
  •  In the <head> section , use the <link>  tag to reference the external CSS file.

  •  HTML file:-


Output is :-


# Attribute :
  • rel="stylesheet" :- This attribute tells the browser about the relationship between an HTML file and the linked file.
  • href="style.css" :- This attribute specifies the path to your CSS file.

#Advantages of CSS:-

  • CSS allows you to separate your HTML content from style. Making code easier to manage.

  • CSS provides greater style options like transitions , CSS 2D transforms, keyframes , for looking website creative and attractive.

  • CSS also saving your time effort. It can be reused across multiple pages.

Comments

Popular posts from this blog

WEBSITE DEVELOPMENT USING HTML AND CSS

Introduction to CSS ✍️

Advanced properties of CSS