Translate

ads

22 May 2019

Types of CSS


Types of CSS 



Cascading style Sheet(CSS) is employed to line the design in sites that contain HTML components. It sets the background color, font-size, font-family, color, … etc property of components in an exceedingly sites.
There area unit 3 sorts of CSS that area unit given below:


  • Inline CSS
  • Internal or Embedded CSS
  • External CSS

Inline CSS:

 Inline CSS contains the CSS property within the body section hooked up with part is thought as inline CSS. this type {of vogue|of favor|of fashion} is such inside associate HTML tag exploitation style attribute.

<!DOCTYPE html> 
<html> 
 <head> 
  <title>Inline CSS</title> 
 </head> 

 <body> 
  <p style = "color:#009900; 
     font-size:50px; 
     font-style:italic; 
     text-align:center;"> 
  Sayed 360 </p> 
 </body> 

</html>  

Output:
   

Internal or Embedded CSS:


 this could be used once one hypertext mark-up language document should be titled unambiguously. The CSS rule set ought to be among the hypertext mark-up language move into the pinnacle section i.e the CSS is embedded among the hypertext mark-up language file.


<!DOCTYPE html>
<html>
 <head>
  <title>Internal CSS</title>
  <style>
   .main {
    text-align:center;
   }
   .SIS {
    color:#009900;
    font-size:50px;
    font-weight:bold;
   }
   .Sayed {
    font-style:bold;
    font-size:20px;
   }
  </style>
 </head>
 <body>
  <div class = "main">
  <div class ="SIS">Sayed 360 </div>
  <div class ="Sayed">A computer science portal for Sayed 360</p>
  </div>
 </body>

</html> 

Output:


External CSS:


 External CSS contains separate CSS file that contains solely vogue property with the assistance of tag attributes (For example category, id, heading, … etc). CSS property written during a separate file with .css extension and will be connected to the HTML document victimization link tag. this implies that for every component, vogue may be set just one occasion which are going to be applied across websites.

Below is that the HTML file that's creating use of the created external sheet of paper

link tag is employed to link the external sheet of paper with the HTML webpage.
href attribute is employed to specify the placement of the external sheet of paper file.


<!DOCTYPE html>
<html>
 <head>
  <link rel="stylesheet" href="sayed.css"/>
 </head>
 <body>
  <div class = "main">
  <div class ="SIS">Sayed360</div>
  <div id ="Sayed">A computer science portal for Sayed360</p>
  </div>
 </body>

</html> 


Output:




Properties of CSS:


 Inline CSS has the best priority, then comes Internal/Embedded followed by External CSS that has the smallest amount priority. Multiple vogue sheets may be outlined on one page. If for AN hypertext markup language tag, designs square measure outlined in multiple vogue sheets then the below order are followed.

As Inline has the best priority, any designs that square measure outlined within the internal and external vogue sheets square measure overridden by Inline designs.
Internal or Embedded stands second within the priority list and overrides the designs within the external sheet of paper.
External vogue sheets have the smallest amount priority. If there are not any designs outlined either in inline or internal sheet of paper then external sheet of paper rules square measure applied for the hypertext markup language tags

1 comment: