I am trying to put some divs around span, I am having problems with getting the height and width of the text. I don't use box shadows as they will be used in an animation. Here is a link with a picture of how I want it to look. Here is the code currently.
I tried multiple methods including having multiple spans which are the same, but I can't include the ::after code as that will make my code all weird and having a .mid and .max width, but that also messed up my ::after code and transitions.
:root {
--txt-color: #fff;
--txt-box-bg: #424242;
--main-bg: #000;
--transparent: transparent;
/* front page title text */
--main-front-color: #e84118;
--second-front-color: #fbc531;
--third-front-color: #00a8ff;
}
* {
margin: 0px;
padding: 0px;
}
/* Text */
.head-text {
font-family: "IBM Plex Sans", sans-serif;
color: var(--txt-color);
}
.main-text {
font-family: "IBM Plex Mono" monospace;
color: var(--txt-color);
}
.bold {
font-weight: bold;
}
.normal {
font-weight: normal;
}
.light {
font-weight: lighter;
}
/* Allgin */
.center {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* classes */
.front-page {
background-color: var(--main-bg);
}
.full-page {
background-size: cover;
height: 100vh;
}
/* IDs */
#title-text {
position: absolute;
display: inline-block;
background-clip: text;
color: transparent;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
white-space: nowrap;
background-image: linear-gradient(#000,#000);
background-size: 100% 100%;
background-position: right;
background-repeat: no-repeat;
transition: 1s all;
font-weight: bold;
text-align: center;
font-size: 90px;
-webkit-text-stroke: 2px var(--main-front-color);
animation: stroke-rainbow 13s linear infinite;
z-index: 2;
}
#title-text::after {
content: '';
display: block;
width: 0;
height: 4px;
background: var(--txt-color);
transition: 1s all;
animation: stroke-rainbow 13s linear infinite;
}
#title-text:hover {
background-size: 0% 100%;
}
#title-text:hover::after {
width: 100%;
}
@keyframes stroke-rainbow {
0% {
border-color: var(--main-front-color);
-webkit-text-stroke-color: var(--main-front-color);
background-color: var(--main-front-color);
#title-text::after {
}
}
25% {
border-color: var(--second-front-color);
-webkit-text-stroke-color: var(--second-front-color);
background-color: var(--second-front-color);
}
50% {
border-color: var(--third-front-color);
-webkit-text-stroke-color: var(--third-front-color);
background-color: var(--third-front-color);
}
75% {
border-color: var(--second-front-color);
-webkit-text-stroke-color: var(--second-front-color);
background-color: var(--second-front-color);
}
100% {
border-color: var(--main-front-color);
-webkit-text-stroke-color: var(--main-front-color);
background-color: var(--main-front-color);
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,400i|IBM+Plex+Sans:100,100i,400,400i,700,700i" rel="stylesheet">
<title>Portfolio</title>
</head>
<body>
<!-- Full page intro -->
<div class="front-page full-page">
<span id="title-text" class="center head-text">Hi</span>
</div>
</div>
</body>
</html>