HTML & CSS: Simple Cheat Sheet

ยท

1 min read

HTML

A Simple HTML Element

<parent attribute-name="attribute value" key="value" >
    <child attribute-name="attribute value" key="value" >
        Hello
    </child>
</parent>

Example:

<div id="container" >
    <h1 id="title" class="text title" >
        Hello
    </h1>
    <p class="text paragraph" >
        How are you?
    </p>
</div>

An Empty HTML Page Structure

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
</html>

CSS

A Simple CSS Block

type#id.class {
    background-color: red;
}

Example:

#title {
    color: green;
}

div {
    background-color: white;
}

.text {
    font-family: Vazirmatn, "Segoe UI", sans-serif;
}
ย