Skip to content
CODE THE PIXEL
Misc

Glowing Animated Box Using CSS

Asyraf Wahi Anuar Updated 1 min read

There are few methods to create a glowing effect using CSS. This tutorial will guide you to create a simple box using HTML and CSS. First, create a basic HTML page and save it as index.html.

This tutorial may be outdated

It was last reviewed 4 years ago. Some steps may differ in newer versions.

There are a few methods to create a glowing effect using CSS. This tutorial will guide you to create a simple box using HTML and CSS. First, create a basic HTML page and save it as index.html. The index.html should contain the basic HTML code with the div="glowbox" as shown below:

HTML
<!DOCTYPE html>
<html>
    <head>
        <title>Glowing Animated Box Tutorial</title>
        <link rel="stylesheet" type="text/css" href="/style.css">
    </head>
    <body>
        <div class="glowbox"></div>
    </body>
</html>

Create a CSS file (style.css) with the following code inside it as shown below:

CSS
body {
    margin: 0;
    padding: 0;
    background: #656262;
}
.glowbox {
    position: relative;
    margin: 100px auto 0;
    width: 600px;
    height: 400px;
    background: #ecf0f5;
}
.glowbox:before,
.glowbox:after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    background: linear-gradient(45deg,#fb0094,#0000ff,#00ff00,#ffff00,#ff0000,#fb0094,#0000ff,#00ff00,#ffff00,#ff0000);
    background-size: 400%;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    z-index: -1;
    animation: animate 20s linear infinite;
}
.glowbox:after {
    filter: blur(20px);
}
@keyframes animate {
    0%
    {
        background-position: 0 0;
    }
    50%
    {
        background-position: 400% 0;
    }
    100%
    {
        background-position: 0 0;
    }
}

That all, happy coding :)

Did this tutorial help?

220 readers found this helpful

Comments

No comments yet. Questions about this tutorial are welcome here: the answer helps the next reader too.

Leave a comment

Markdown works: `code`, ``` blocks, **bold**, links.

First comments are reviewed before they appear.

Misc

Animated Line

The animated line tutorial is created using HTML and CSS. developer can use animated lines to enhance their application or web UI to make it look more attractive. It is recommended to use a web-kit web browser such as Chrome or Firefox.

1 min read

Misc

Web scraping using PHP Simple HTML DOM Parser

This tutorial will explain how to use PHP Simple HTML DOM Parser to extract specific content from a website and publish it into another website. Web scraping is the process of extracting data or content from a website. The extracted data or content can be published on other websites or saved into a...

4 min read

Misc

Git Tutorial: Uploading a Project to GitHub and Collaborating with Others

Version control is essential for developers, and Git is a powerful tool that helps manage project changes efficiently. GitHub, a popular platform built on Git, not only hosts repositories but also facilitates collaboration among developers worldwide. In this tutorial, we will explore the process of...

4 min read