Hey there!
Hope you an help me out here (again
)
I want to insert a blinking cursor at the end of my text using javascript. However when the cursor blinks the blue colored area gets bigger than the blue colored area behind the text. Might be easier to see with the screenshoot...How do I prevent that from happening? I want the curser to just be 'within' the blue background color. Hope it makes sense!
[CODE lang="css" title="Blinking cursor problem"]<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hey there</title>
<!--font 'Open Sans'-->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
<!--font 'JetBrains Mono''-->
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet">
<script src="https://unpkg.com/typewriter-effect@latest/dist/core.js"></script>
<script>var cursor = true;
var speed = 400;
setInterval(() => {
if(cursor) {
document.getElementById('cursor').style.opacity = 0;
cursor = false;
}else {
document.getElementById('cursor').style.opacity = 1;
cursor = true;
}
}, speed);</script>
<style>
.textfield {
color: rgb(239, 61, 74);
line-height: 55px;
text-align: right;
margin-left: 65px;
margin-right: 25px;
font-size: 25px;
}
.textfield span {
background-color: rgb(150, 203, 209);
color: rgb(239, 61, 74):
display: inline;
font-family: "JetBrains Mono", Sans-serif;
text-align: right;
}
#cursor {
font-size: 30px;
color: none !important;
background-color: none !important;
}
</style>
</head>
<body>
<h1 class = "textfield"> <span> #3 TEST TEST<span id="cursor">_</span></span></h1>
</body>
</html>
[/CODE]
Hope you an help me out here (again
I want to insert a blinking cursor at the end of my text using javascript. However when the cursor blinks the blue colored area gets bigger than the blue colored area behind the text. Might be easier to see with the screenshoot...How do I prevent that from happening? I want the curser to just be 'within' the blue background color. Hope it makes sense!
[CODE lang="css" title="Blinking cursor problem"]<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hey there</title>
<!--font 'Open Sans'-->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
<!--font 'JetBrains Mono''-->
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet">
<script src="https://unpkg.com/typewriter-effect@latest/dist/core.js"></script>

<script>var cursor = true;
var speed = 400;
setInterval(() => {
if(cursor) {
document.getElementById('cursor').style.opacity = 0;
cursor = false;
}else {
document.getElementById('cursor').style.opacity = 1;
cursor = true;
}
}, speed);</script>
<style>
.textfield {
color: rgb(239, 61, 74);
line-height: 55px;
text-align: right;
margin-left: 65px;
margin-right: 25px;
font-size: 25px;
}
.textfield span {
background-color: rgb(150, 203, 209);
color: rgb(239, 61, 74):
display: inline;
font-family: "JetBrains Mono", Sans-serif;
text-align: right;
}
#cursor {
font-size: 30px;
color: none !important;
background-color: none !important;
}
</style>
</head>
<body>
<h1 class = "textfield"> <span> #3 TEST TEST<span id="cursor">_</span></span></h1>
</body>
</html>
[/CODE]