Answer 1, authority 100%
I think a generalized answer is needed so that newbies who have come here for the answer will be fully informed with examples.
There are 4 ways.
1. Inline Styles
Connecting inline or inline
styles is to apply the style
attribute to a specific tag on the page. In this case, the attribute value is one or more (semicolon-separated) CSS properties with corresponding values. As a rule, this method is used when it is necessary to change the characteristics of a specific element on one page.
& lt;! DOCTYPE html & gt;
& lt; html & gt;
& lt; head & gt;
& lt; meta http-equiv = "Content-Type" content = "text / html; charset = utf-8" & gt;
& lt; title & gt; Inline Styles & lt; / title & gt;
& lt; / head & gt;
& lt; body & gt;
& lt; p style = "color: # ff0066; text-align: center" & gt; Paragraph 1 & lt; / p & gt;
& lt; p style = "color: # 0066ff; font-size: 120%" & gt; Paragraph 2 & lt; / p & gt;
& lt; / body & gt;
& lt; / html & gt;
Answer 2, authority 75%
in the head of your html write
& lt; link rel = "stylesheet" href = "css_file_path" / & gt;
Answer 3, authority 50%
& lt; head & gt;
...
& lt; link rel = "stylesheet" type = "text / css" href = "path to file / style.css" & gt;
...
& lt; / head & gt;
Answer 4, authority 38%
There are two more ways:
& lt; style type = "text / css" & gt;
/ * Here is your code for example: * /
body {
background-color: black;
}
& lt; / style & gt;
and through the style
attribute of all tags for example:
& lt; div style = "position: absolute; top: 5px; left: 2px;" & gt; & lt; / div & gt;
or
Answer 5
By the way, colleagues have described all the methods above. Most likely you cannot attach via the location of the style file . Or call it non-Russian letters. : 3
& lt; link href = "here you need to specify the path, assuming that index.html is located in the root folder" rel = "stylesheet "& gt;
& lt;! - type = "text / css" is not customary to write in HTML5 - & gt;
Answer 6
It is best to connect through the
tag
& lt; head & gt;
& lt; link rel = "stylesheet" href = "css / style.css" & gt;
& lt; / head & gt;
Other ways how to connect CSS to HTML can be read on the site