- CSS is a language that describes the style of an HTML document.
- CSS describes how HTML elements should be displayed.
- The
<style>tag is used to define style information for an HTML document.
<head>
<style>
h1 { color:red; }
p { color:blue; }
</style>
</head>- The
<link>tag defines a link between a document and an external resource. - The
<link>tag is used to link to external style sheets.
HTML File
<head>
<link rel="stylesheet" type="text/css" href="theme.css">
</head>CSS File
h1 { color:red; }
p { color:blue; }- In CSS, selectors are patterns used to select the element(s) you want to style.
https://www.w3schools.com/cssref/css_selectors.asp
https://www.w3schools.com/cssref/default.asp
<!DOCTYPE html>
<html>
<head>
<title>Background Color</title>
<style>
body {
background-color: lightblue;
}
</style>
</head>
<body>
The content of the document...
</body>
</html>https://next.plnkr.co/edit/RLx7UHYDMLgNcprN?preview
<!DOCTYPE html>
<html>
<head>
<title>Centered Squares</title>
<style>
section {
background-color: #003b6f;
height: 500px;
width: 500px;
}
main {
background-color: #F79862;
height: 400px;
width: 400px;
}
.center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<section class="center"></section>
<main class="center"></main>
</body>
</html>https://next.plnkr.co/edit/CDpTB58wafJi1iWJ?preview
<!DOCTYPE html>
<html>
<head>
<title>Centered Circle</title>
<style>
#cyan-dot {
height: 200px;
width: 200px;
background-color: #008B8B;
border-radius: 50%;
}
.center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div id="cyan-dot" class="center"/>
</body>
</html>