/ Views: 71272

How to connect CSS?

Watch the video

How to connect CSS?

Today it’s hard to imagine a modern website without CSS. HTML is the skeleton of a site, while cascading style sheets are its face, which makes the site attractive and different from others (read the article What is CSS). But how to connect CSS to the site?

Connection methods

There are three ways to connect CSS: the first is to add CSS code to the site header (global styles), the second is to prescribe styles for each element (internal), and the third is to separate the code into a separate file and send it to it (related).

Global styles of this type: “<style type =" text / css "> p {line-height: 130%; } </ style> ", and the internal such:" <div style = "background: #ccccc; border: 1px # 000000 solid;"> Block </ div> ".

The second method increases the loading time of the document, the first can be applied on some pages where it is necessary, for example, to adjust the code of the associated styles. And, actually, the related styles themselves are the basis of the CSS of any site.

Related styles

In order to connect the file with the associated styles to the site, you need to add the code "<link rel =" stylesheet "type =" text / css "href =" http://elhowcss.ru/style.css ">", where the value parameter href - path to the CSS file. It can be specified both relative (/css/main.css) and absolute (http://elhowcss.ru/css/main.css).

The code should be placed in the header of the site, that is, inside the pair of tags <head>. This method is the most universal and rational, since HTML only refers to a file with CSS, and the two languages ​​are separate.

Import styles

In turn, other styles can be connected to styles. In global styles, you need to add code: “@import url (" / css / fullpage.css ");", and in related ones - "@import" /style/fullpage.css "screen;". Both relative and absolute paths can also be used here.

[/L_REPEAT]

Related news


What is dried apricots
Bags
Grieving for loved ones is the norm
Light sensor
How to treat colpitis
Olive Oil Tips
Who can help