CSS is a style sheet language that allows you to create web pages and control multiple features at the same time by assigning specific elements to groups. For example, using a color code, a designer can change the background color on all pages of a site with just one change to the CSS code.
Steps
Part 1 of 4: How to Write Inline CSS

Step 1. Familiarize yourself with HTML tags
Need to know how tags and attributes work
src
and
href
.

Step 2. Explore some of the basic properties of CSS
There are many properties, but you don't need to memorize everything.
- Remember the following basic CSS properties:
color
andfont-family
.

Step 3. Examine the values of the corresponding properties
A value is specified for each property. For example, for the property
color
you can specify a value
red
.

Step 4. Review the HTML Attribute
style
.
It is used inside the element
href
or
src
… To use the specified attribute, in quotation marks after the equal sign, enter the CSS attribute, a colon, and then the property value. This is called a CSS rule.

Step 5. Please note that professional web developers generally do not use inline CSS to build websites
Inline CSS can compromise the integrity of HTML. However, it is a great way to get familiar with the basics of how CSS works.
Part 2 of 4: How to Write Simple CSS Code

Step 1. Run the program where you can create HTML and CSS files
If there is no special program, use Notepad or another text editor. Just save the file as a text file and a CSS file

Step 2. Open the HTML code
Do it in your HTML editor (if you have one).
In the HTML editor, you can work with HTML code and CSS code

Step 3. Create a tag inside the HTML tag
In this case, the CSS code can be written without the need to create a separate file.

Step 4. Select the element to which you want to add a style
Now enter the element name and curly braces ({}). To make your code more legible, always enter the second curly brace on a new line.

Step 5. Inside the brackets, enter the CSS rule as if you were using the attribute
style
.
Each line must end with a semicolon (;). To make your code legible, enter each rule on a separate line, and each line should be indented.
Note that this style will affect “all” elements of the selected type on the page. A more specific style will be discussed in the next section
Part 3 of 4: How to Write More Complex CSS

Step 1. Create a CSS file (not an HTML file) and save it with the extension
.css
.
Also open the HTML file.

Step 2. Create a tag inside the HTML tag
This will link the separate CSS file to the HTML file. The tag requires three attributes:
rel
,
type
and
href
.
-
rel
tells the browser how to treat the HTML file. Here this attribute should have a valuestylesheet
. -
type
tells what type of media the link belongs to. Here this attribute should have a valuetext / css
-
href
it is used here the same as in the element, but here this attribute must refer to the CSS file. If the CSS file is in the same folder as the HTML file, use only the file name in quotation marks.

Step 3. Select elements of different types to which you want to add one style
Add the attribute
class
to such elements and equate them to the name of the selected class. In this case, the elements will have the same style.

Step 4. Indicate which style the class will receive
In the CSS file, enter the class name after the period., That is, like this:
.class
.

Step 5. Select the individual elements to which you want to add a custom style and add the attribute
id
.
In CSS, identifiers are created using the # symbol, not a period.
Identifiers are more specific than classes, so an identifier overrides any class style if it has an attribute with a value other than the class value
Part 4 of 4: How to Learn CSS and HTML

Step 1. Open the HTML Academy website
On it you can learn the basics of web development.

Step 2. Find other sites specifically dedicated to learning HTML and CSS
Look for reputable sources to build on your knowledge.

Step 3. Chat with web designers and developers
Their experience will help you acquire valuable knowledge and skills.

Step 4. View the source codes of the sites that you open
Looking at the CSS codes of well-made websites will give you an idea of how to design parts of websites. Copy the code and then edit it to learn how to use the various CSS attributes.