How to link External CSS Stylesheet to HTML

Cascade style sheets they are of three types; first one is the inline type, second one is the internal CSS, and in the next case we are going to use an external CSS. That is why we will be needing to create a separate stylesheet.CSS. In that particular case I would like to recommend here that always in the first case create a new folder which should be known as CSS; and inside this new folder we are now creating a file which should be termed as stylesheet.CSS.

Here it goes. This is the stylesheet.CSS. So why did we place this stylesheet.CSS into a separate folder?

Always keep in mind while you will be creating some actual project, you will be working live on a particular project, there should be a numerous number of CSS files or a number of fonts those will be practically used here and in that case, you will be needing a separate folder where all like type contents, like these .CSS files, glyph icon files or those font awesome files; all those things should be placed inside a particular CSS from where fetching will be easily done and that is why we have created a separate folder inside the root folder of HTML-CSS-integration and inside this particular CSS folder we will be placing this stylesheet.CSS.

Now in the very first case all we need to do we need to define this charset which is practically getting used over here. On the other hand, we need to mention that this is practically a CSS document. So, these are the things those in the first case we need to define. It is practically defining that it is obeying the character set of UTF-8. This is a kind of declaration that is needed to be declared on top of every CSS document. And in the next case we need to declare this one this CSS document type. This is practically a CSS comment. We will be knowing about it; how to make a CSS comment. I am sorry we have forgotten to provide a semicolon over here. So practically every particular CSS document, it is practically composed of – first of all, the class or an ID. So, in case of class, you need to provide this dot or full-stop and in case of an ID you need to provide a hashtag.

So, if you are using a full-stop or a dot, then you were declaring a class to be attributed.

In case if you are using a hashtag then it is an ID. Remember that an ID is the fastest selector into a CSS document. Any selector name can be obtained very easily if it is attributed with an ID. On the other hand, a class can be used many times while and it can be used once into the same page.

That means if you create an ID like this one… If you name it as a selector, this particular ID it can be used once into this particular index.html. And if you use here a selector name, selector class actually, then it can be used multiple times into this particular index.html or into a project. So that is why ID is the fastest selector as it can be used here. What is the universal selector? It is practically used to provide some particular attributes for all of the elements which is present into a particular page.

For say into this index.html, it will be having the same property for all of the elements inside your index.html. So, if we use here, if we declare here *, this should be a Universal selector. Now provide here margin 0 and padding 0; in that particular case every element inside this particular index.html, they will be having a constant zero margin and zero padding. So, this is the purpose of Universal selector. This Asterix sign, it is practically serving as a Universal selector, and this is the actual syntax in case of CSS Universal selector. On the other hand, as we have termed previously that there are some general selectors, such as, we know that in this particular case we have used this H2, this header tag, or this div element over here; so, all those things those things are practically general tags. That means the tags those are already in use in your HTML page, all you need to do, you need to mention it as this one; no need to mention any class or ID because these things are not user defined, these things are already present in your HTML document, and they are known as general tags.

So, we are just defining the properties of those general tags those have been used in index.html and in that case we have targeted this particular HTML element over here.

So, in this case we are now providing a background color of, for say, #000; let’s provide a dark background color and see what happens. So this is the general selector that is been used over here; this is the universal selector. Now in this particular case we need to link this style sheet.CSS with this index.html.

So we are getting back to our project into our index.htm l. First of all we are removing this style; we are not using any internal CSS over here; so we don’t need to declare any kind of Style element so that is why we are removing it and instead as we have told you previously that head is the segment where you can define all of your sources. So the exact same things should be carried on over here.

We are now defining…. We need to link this stylesheet.CSS with this index.html. Where exactly this style sheet is now being used? This stylesheet is now within a CSS folder which folder is inside this HTML-and-CSS-integration root project. That is why we created this root folder over here inside of which we have placed everything that we will be using into this project. First of all, we are defining the folder name… It has to be something like this…
So, this is the syntax actually that would be declared over here. And here folder name means? Which folder name? The folder which is practically holding the required files or style sheets of CSS or any kind of files required to be declared over here to be connected to this page. So, this stylesheet.CSS is inside this folder; so that is what we will be providing over here.CSS. And in the next case you need to provide the filename which is known as style sheet.

What should be the extension name? CSS should be the extension name.

Next, we are declared in the relevance of it, and it is… And the type of it? It is text/CSS.

So, this is the linkage of style sheet.CSS along with this index.html. Now we need to check out whether this link has been established or not?

So that is why we will be getting back to our project reloading, and we can see that already this page is now connected; we have placed here this HTML element, we have provided this background color to this HTML page, what? Dark colored! And that is exactly what we are observing here looking at right now.

So, we can safely conclude that this particular style sheet.CSS is now linked to index.html.

https://rosebays.aidady.com/book

https://www.masterresellrights.com/mrr/aff/go/negoyes566cvb

Site Clone Machine is a PHP script which allows you to make copies, clones or archives of any website. With Site Clone Machine, you can start earning some bucks from web designing and smartly.


Discover more from Making Money Is Easy

Subscribe to get the latest posts sent to your email.

About amorosbaeza1964

Hello, my name is Jose Amorós first of all I wish you a warm welcome to my blogs. It will be a pleasure to share with all of you information about my career and thus evaluate knowledge that will be beneficial for both of us. If you wish, you can contact us through the form, thank you!
This entry was posted in Website and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply