CSS :-Text and background color

<!DOCTYPE html> 

<html> 

 

<head> 

 <meta name="viewport" content="width=device-width, initial-scale=1"> 

 

 <style> 

  .clr_cls { 

   background-color: red; 

   color: yellow; 

  } 

 </style> 

 

</head> 

 

<body> 

 <div class="clr_cls"> 

  Genius Student

 </div> 

 

</body> 

 

</html




Used of :- 

Text and background color


CSS Introduction
  • CSS stands for Cascading Style Sheets.
  • Describes the style of an HTML document.
  • Describes how HTML elements are to be displayed on screen or in other media (mobile,tablet).
  • It saves a lot of work. It can control the layout of multiple web pages all at once.
  • It is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes.
Types of CSS
  • 1) In a separate .css file (external css). This is the recommended one
    eg:-
    <link type="text/css" rel="stylesheet" href="path.css">
    
  • 2) Write inside the <style> tag (internal css)
    eg:-
    <style>
    .clatest
    {
      color:red;
    }
    </style>
    
  • 3) Write the css properties with styleattribute (inline css)
    <div style="color:red;"></div>
    
Basic syntax of CSS
  • CSS contains two parts : selector and declaration.
    • For example:
        h1{
          color: yellow;
          background-color: red;
        }
      Selector - h1 
      Declaration - {color:blue;background-color: red;}

  • The selector points to the HTML element where you want to add style.
  • The declaration block contains one or more CSS properties separated by semicolons.
How to Run in computer?
This file will not execute alone, it will execute with .html file only. So we can follow the HTML run instruction as per the previous HTML tutorial.
CSS :-Text and background color CSS :-Text and background color Reviewed by Network security on May 05, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.