CSS3 in 10 days — Day 5

Photo by Greg Rakozy on Unsplash

Welcome to Day 5 of learning CSS. You can find Day-4 here.

As i have told earlier, this series is inspired by this awesome youtube series in freecodecamp channel.

We will start with CSS only Modal Window on day-5. Open your code editor and create a new 5.1-ModalWindow folder and two files index.html and sandbox.css inside it.

Next, in index.html put the basic html.

Basic html

Also, put the basic style of the button. On clicking the button, we will display the modal.

Basic button

It will show our index.html as the below in browser.

Basics

We will first style the overlay. So, head over to sandbox.css and put the below code.

Overlay

So, now if you click on the button the overlay will cover the whole browser. Now, we will write style for the modal.

modal style

And our modal is complete. Click on the button Click to launch modal to open the modal and close it by clicking on the Close button.

Button logic

Next, we will create a CSS only Pacman. Open your code editor and create a new 5.2-Pacman folder and two files index.html and sandbox.css inside it.

Next, in index.html put the basic html.

Pacman begins

The html doesn’t contain any style. All the code happens in CSS. Let’s first create the path for the Pacman.

Path

It will show the path in the browser.

The dotted path

Let’s create the pacman now. We are creating it from two separate blocks, which we are using in before and after pseudo element.

Pacman

We will now see the pacman in the browser.

Pacman in browser

Now, let’s animate the pacman close and open it’s mouth.

Animation code

You can now see the below in browser.

Pacman Closing opening

Now, we will make the pacman move from left to right. For this we will add a moveForward animation.

moveForward

Now, our pacman is moving.

Moving pacman

Let’s create the Ghost now. Put the below in sandbox.css to create the ghost.

Ghost Code

It will show the below in browser.

Ghost in the browser

Now, we will make the pupil of the ghost.

Pupil

Which will now show the blue pupil of the Ghost.

Blue pupil

Now, we will give the Ghost a nice skirt.

Skirt code

And we get the skirt.

The Skirt

Now, we will do the animation for the Ghost.

Code
The Animation

This completes our pacman animation.

The final

This completes day 5 of the course. You can find Day 6 here.

You can find the code for the same here.

--

--

--

Founder TWD, JavaScript & ReactJS Trainer, Youtuber, Blogger

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Discord Scheduling Bot for Business

Breaking Kubernetes: How We Broke and Fixed our K8s Cluster

Now that Apple has finally launched

Theta Edge Node adds new video transcoding jobs, the first step in Theta tackling the $1.1B

BSC.chat Interview Transcript with Wynaut/Meownaut

Golang, Opentelemetry, and Sentry — The Underrated Distributed Tracing Stack

Building a Puzzle Game in Flutter

Dynamic programming is simple #3 (multi-root recursion)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nabendu Biswas

Nabendu Biswas

Founder TWD, JavaScript & ReactJS Trainer, Youtuber, Blogger

More from Medium

Making Website Preloader Using HTML CSS JS

Beginner’s Roadmap to Web Development

Make a Background Image blurred & show your image

Top 6 Resource for Front-End Web Developer 👨‍💻