It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 17 May 2020
Long texts are boring. So you should find a way to make them attractive. One way is not to show the whole text instantly to the visitors. Instead you can add an effect that computer types and highlights it. See the following example!
<!-- this script is provided by https://www.javascriptfreecode.com coded by: Kerixa Inc. -->
<style>
@import url("https://fonts.googleapis.com/css?family=Lora:400,400i,700");
body {
display: flex;
flex-direction: column;
height: 100vh;
justify-content: center;
align-items: center;
background-image: linear-gradient(rgba(16, 16, 16, 0.8), rgba(16, 16, 16, 0.8)), url(https://www.javascriptfreecode.com/uploads/pictures/26-1.jpg);
background-size: cover;
}
p {
margin: 0em 5em 4em 5em;
}
h1, p {
text-align: left;
line-height: 1.8;
font-family: Lora, serif;
}
.glowIn {
color: white;
}
.glowIn span {
animation: glow-in 0.8s both;
}
@keyframes glow-in {
from {
opacity: 0;
}
65% {
opacity: 1;
text-shadow: 0 0 25px white;
}
75% {
opacity: 1;
}
to {
opacity: 0.7;
}
}
</style>
<h1 class="glowIn">Hello World</h1>
<p class="glowIn">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Mattis pellentesque id nibh tortor. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. A lacus vestibulum sed arcu.</p>
<script>
"use strict";
var glowInTexts = document.querySelectorAll(".glowIn");
glowInTexts.forEach(function (glowInText) {
var letters = glowInText.textContent.split("");
glowInText.textContent = "";
letters.forEach(function (letter, i) {
var span = document.createElement("span");
span.textContent = letter;
span.style.animationDelay = i * 0.05 + "s";
glowInText.append(span);
});
});
</script><a target='_blank' href='https://www.javascriptfreecode.com' style='font-size: 8pt; text-decoration: none'>JavaScript Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!