Ways to include CSS in HTML. Embedding CSS in an HTML document
Good day to all. Alexey Gulynin is in touch. In this first article on CSS, I would like to talk about CSS in general, and how . CSS is Cascading Style Sheets(or simply can be called styles), which are responsible for how to display elements on your html page. If you simply add elements to an HTML page without attributes, then they will all be placed from top to bottom and will be aligned to the left side of the browser. It's boring and monotonous.
HTML elements are the framework of our page, i.e. html is responsible for WHAT to display on the page. CSS, in turn, answers HOW to display all these elements. You can create the same HTML page and come up with thousands of design options for it. And all this will look like different sites. You can surf the Internet and see how many beautiful sites there are on its expanses.
On this moment, you should have realized that if you want to create Beautiful design, then without knowledge of CSS, you will not be able to do this. Therefore, go ahead to comprehend this science called CSS.
Let's connect the CSS style file to the html page. This is done in the document header, between the tags
.. :
Let's figure out what we wrote here. Style files are connected using the link tag. The href attribute, already familiar to us, points to the path to the style file. Here you can specify both absolute and relative paths. IN in this case it is assumed that our style.css file is located in the same directory as the file in which we include styles. The type="type/css" attribute indicates that the document type is css, the rel="stylesheet" attribute tells the browser that we are including styles (rel from English "relationship" - relationships).
You can also style elements in other ways. Let's create an html page with the following content:
First paragraph
First paragraph
First paragraph
First paragraph
In addition to creating a style file, we can write styles in the document head using the tag
First paragraph
Second paragraph
Third paragraph
Fourth paragraph