All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

CSS Insert CSS

There are three ways to insert CSS into a document.

  • External Style Sheet
  • Internal Style Sheet
  • Inline Style


    • External Style Sheet
    • External Style Sheet is the best way to insert style in a webpage.The main advantage of this is you can add external style sheet to as many web pages as you want and change the look of all the webpage by changing just one css file.


      You can insert the css file in webpage as shown below.

      <link rel="stylesheet" type="text/css" href="demo.css">
      

      Make a CSS file and define the style rules and save it as filename.css(eg. demo.css).

      p
      {
      color:red;
      }
      



    • Internal Style Sheet
    • Internal Style Sheet is used in only single document.You define internal styles in the head section of an HTML page, inside the <style> tag

      <head>
      <style>
      p
      {
      color:blue;
      border:1px solid red;
      }
      </style>
      </head>
      



    • Inline Style Sheet
    • Inline Style Sheet is define in the starting of any element just by adding style attribute.

      <p style="color:blue;border:1px solid red;">This is the example of inline styling.</p>
      
    ❮ PrevNext ❯