This is the code, can someone explain how it works.
.top-2\.5{
top:0.625rem;
}
.top-1\/2{
top:50%;
}
This is the code, can someone explain how it works.
.top-2\.5{
top:0.625rem;
}
.top-1\/2{
top:50%;
}
\
is used as an escape sequence. Refer this to know more.
Those CSS
class name can be referenced in HTML
tags as follows:
<body>
<h1 class = "top-1/2">My First Heading</h1>
<p class = "top-2.5">My first paragraph.</p>
</body>
Full code reference:
<!DOCTYPE html>
<html>
<head>
<style>
.top-2\.5{
top:0.625rem;
color: red;
}
.top-1\/2{
top:50%;
color: blue;
}
</style>
<title>Page Title</title>
</head>
<body>
<h1 class = "top-1/2">My First Heading</h1>
<p class = "top-2.5">My first paragraph.</p>
</body>
</html>