Center div vertically and horizontally with CSS

Let’s say that we want to center a div inside our body element. Our code looks like this:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/css/style.css">
</head>
<body>
    <div>
        <h1 class="title">Hello You!</h1>
    </div>
</body>
</html>

 

In CSS grid we can do something like this:

body {
   height: 100vh;
   display: grid;
   place-items:center;
}

This is nice and easy trick!

You can also read this

Error handling with ExpressJS

Error Handling refers to how Express catches and processes errors...

app.get('/', function (req, res, next) {
  fs.readFile('/file-does-not-exist', function (err, data) {
})

Responsive CSS counter without Javascript

CSS counters let you adjust the appearance of content based on...

@media (max-width: 319px) {
    .small-card__item:nth-child(1)~.small-card__item {
        counter-increment: item-count;
    }
}