How to link external CSS with HTML file?


What is External CSS?

  •  External css is a single file. 
  •  Using this single file we can make chage of the entire website.
  •  The file have been saved with .css .
  •  The css file should  not have any html tags.

How to link external css file with HTML file ?

  • We should use the <link> tag at the head section.
  • In link we should have the syntax i.e, rel,hrefa and type.
  • <link rel="" href="" type="">. This was the method to add the css file in html.
  • rel="stylesheet"
  • In href we should add the name of the css file. example: href="style.css"
  • type="css/text"
  • Finally the code will be, <link rel="stylesheet" href="style.css" type="css/text">

Example code:

  index.html

      <html>

     <head>

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

     </head>

    <body>

             <h1>EXTERNAL CSS IN HTML</h1>

   </body>
   </html>

style.css

     h1{
color:blue;
      }
Output:



0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post