how to create a css file code example

Example 1: add stylesheet html

<link rel="stylesheet" type="text/css" href="style.css">

Example 2: import css in another css file

@import "navigation.css"; /* Via string */

or

@import url("navigation.css"); /* Via url */

Example 3: how to refer to external style sheet

<html>
<head>
<link rel="stylesheet" type="text/css" href="Name.css">
</head>
<body>
.
.
.
</body>

Example 4: start a css file

*{
    margin: 0;
    padding: 0;
    color: unset;
    box-sizing: border-box;
    text-decoration: none;
    outline: none;
    overflow-x: hidden;
}

Example 5: how to style in html file

<p style="text-align: center; color: pink;">Hello World</p>

Tags:

Misc Example