HTML

Introduction

CSS Stands for Cascading Style Sheet.
  • It is a language which is used to style the html pages.
  • It describes how html elements are displayed on screen,paper.
  • The difference between css and html is, we use html to create the actual content ofthe web page,and css is used to style the website includes colors,margins,padding,layout.
Syntax:
A css rule set consists of a selector and a declaration block .
      
                                  Declaration
 Selector {  property:value; property:value   }

Ex: p { background-color:gray; color:rfb(10,54,75) }
  • Here selector is nothing but the name of the element,or id name,or class name.
  • Declaration part contains the property and value.
  • property and value are seperated with semicolon and each declaration ends with colon.

Types:
   css are 3 types  
  1.     Inline css
  2.     Internal css
  3.     External css
1.Inline Css:
 i)Inline css means specifying the style in inside an element or styling a particular element
    by using style attribute.
 Syntax:<element name style attribute="property:value;">
        EX: <p style ="color:blue;margin:10px">

2.Internal Css:
   i. Internal css is used to style a web page. it is declared in head section.
  ii. In internal css we can give styles to the elements by using id and class attributes.
  • Id name should be different for each html element.
  • class name can be same for all html elements.
  • By using class and id attribute we can style any element.
Syntax:
             <head>
                <style>
                     tag name/id name/class name
                         {
                           Property:value;
                            property:value;
                          }
                 </style>      
              </head>

EX:By using tagname
       <head>
              <style>
                   p{
                        color:tomoto;
                         margin:10px;
                         font-size:12px;
                       }
                </style>
       </head>
EX:By using Id name
         <head>
               <style>
                   #p{
                        background-color:rgb(250,25,85);
                        padding:10px;
                       }
               </style>
        </head>

EX:By using Class name
        <head>
                <style>
                    p{
                        border:1px solid tomoto;
                        text-align:center;
                       }
                </style>
       </head>

3.External css
   i. By using external css we can style many web pages or to a website.
  ii. It is a seperate file with .css extension.
 iii. We never write any information in external file.we just write the style properties.
 iv. In head section we declare the external css file link.
 Syntax:
     i. Html Code:
         <head>
             <link rel="stylesheet" type="text/css" href="color.css">
         </head>
    ii. Css Code
           body{
                     background-coclor:#f4586a;
                    }

             h1   {
                     color:blue;
                     }