Inclusion

In HTML you can include CSS in three ways -

Inline Style

Almost every elements in HTML support an attribute style which allows us to write CSS within this attribute. For Example -


            <a href="url" style="text-decoration:none;">Click Here</a>
        

You can write more than one CSS Rules inside this attribute -


                <a href="url" style="text-decoration:none; color:blue; font-size:10px;">Click Here</a>
        

Internal Stylesheet

You can write all the CSS code inside the style element using CSS Query selector.


                <head>
                    <style>
                        body {
                            background-color: linen;
                        }
                        
                        h1 {
                            color: maroon;
                            margin-left: 40px;
                        } 
                    </style>
                </head>
        

It doesn't matter where you write your internal style sheet. You can place style element anywhere in the document. But the best practice is inside the head element.

External Stylesheet

You can use External stylesheet file and include them in your HTML file. Using link tag we can do this -


            <head>
                <link rel="stylesheet" href="url">
            </head>
            <body>
                <!-- body -->
            </body>
        

You can use two kind of links here. One is CDN and another is local file. Local file is relative to the HTML document. For this concept refer to the HTML tutorial. You can use CDN that pulls in the file from the dedicated server. It's actually an URL where the file is located. There are some disadvantage and advantage of Using CDN.

It is always better to use local version of file rather than using CDN. Because if you use CDN and the framework version is updated, the update will reflect in your file. This is good as long as you get what you are expecting. Otherwise you have to update your code with the framework version to adopt the changes.