Hey there
I want to make hover effect on my h1 headlines, but it does not work with the <span></span>. It works fine if the header is just wrapped in <h1></h1>, but I need the <span></span> in order for the background color on the header to wrap correctly.
any ideas?
[CODE lang="css" title="hover effect not working" highlight="26"]<!DOCTYPE html>
<html>
<head>
<style>
body {
margin-top: 50px;
color: rgb(184, 170, 140);
}
.textfield {
color: rgb(239, 61, 74);
line-height: 55px;
margin-left: 200px;
font-size: 25px;
line-height: 1.2;
}
.textfield span {
background-color: rgb(38, 102, 145);
color: rgb(253, 103, 73);
display: inline;
font-family: "JetBrains Mono", Sans-serif;
text-align: right;
.textfield span:hover {
color: green;
}
}
p {
font-family: "JetBrains Mono";
margin-right: 150px;
margin-left: 200px;
line-height: 1.5;
}
</style>
<h1 class = "textfield"> <span> #1 TEST. This is a test to see if the hover effect works. </span></h1>
<p>This is a paragraph</p>
<h1 class = "textfield"> <span> #2 TEST </span></h1>
<p> This is a paragraph </p>
</head>
<body>
</body>
</html>
[/CODE]
I want to make hover effect on my h1 headlines, but it does not work with the <span></span>. It works fine if the header is just wrapped in <h1></h1>, but I need the <span></span> in order for the background color on the header to wrap correctly.
any ideas?
[CODE lang="css" title="hover effect not working" highlight="26"]<!DOCTYPE html>
<html>
<head>
<style>
body {
margin-top: 50px;
color: rgb(184, 170, 140);
}
.textfield {
color: rgb(239, 61, 74);
line-height: 55px;
margin-left: 200px;
font-size: 25px;
line-height: 1.2;
}
.textfield span {
background-color: rgb(38, 102, 145);
color: rgb(253, 103, 73);
display: inline;
font-family: "JetBrains Mono", Sans-serif;
text-align: right;
.textfield span:hover {
color: green;
}
}
p {
font-family: "JetBrains Mono";
margin-right: 150px;
margin-left: 200px;
line-height: 1.5;
}
</style>
<h1 class = "textfield"> <span> #1 TEST. This is a test to see if the hover effect works. </span></h1>
<p>This is a paragraph</p>
<h1 class = "textfield"> <span> #2 TEST </span></h1>
<p> This is a paragraph </p>
</head>
<body>
</body>
</html>
[/CODE]