I have been working on creating a simple webpage with fixed-position buttons at the top that showcase various attributes like hover
, box-shadow
, and cursor
. When hovered over, I want these buttons to display some shading around them. To achieve this, I used the position: fixed
attribute within a div
tag as a button frame for easy styling across all buttons.
However, I encountered an issue where once I scrolled down the page, the attributes (such as hover
, box-shadow
, and cursor
) were no longer applied. I am unsure of how to resolve this problem. Any suggestions?
This is the code block I currently have:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="User">
<title>Home Page</title>
<style>
body {
background-color: rgb(255, 255, 255);
margin: 0px;
padding: 0px;
border-style: none;
}
.mainFrame {
position: absolute;
top: 0px;
left: 131px;
width: 700px;
height: 800px;
margin: 0px 0px 31px 0px;
padding: 0px;
border-style: solid;
border-color: rgb(0, 0, 0);
border-width: 0px 2px 2px 2px;
border-radius: 0px 0px 131px 0px;
}
.buttonFrame {
position: fixed;
top: 0px;
left: 133px;
width: 500px;
height: 39px;
margin: 0px;
padding: 0px;
border-style: none;
}
.button {
height: 29px;
margin: 0px;
padding: 4px 7px 4px 7px;
background-color: rgb(255, 99, 71);
border-style: solid;
border-color: rgb(0, 0, 0);
border-width: 0px 2px 2px 2px;
border-radius: 0px 0px 131px 0px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 23px;
text-align: left;
cursor: pointer;
outline: none;
}
.buttonEffect:hover {
box-shadow: 0 13px 17px 0 rgba(0,0,0,0.25), 0 13px 17px 0 rgba(0,0,0,0.25);
outline: none;
}
.Home {
position: absolute;
top: 0px;
left: 31px;
width: 64px;
}
.Notes {
position: absolute;
top:0 px;
left: 144px;
width: 64px;
}
.AboutMe {
position: absolute;
top: 0px;
left: 257px;
width: 105px;
}
.contentFrame {
position: absolute;
top: 40px;
left: 0px;
width: 500px;
height: 400px;
margin: 0px;
padding: 0px;
border-style: none;
}
</style>
</head>
<body>
<div class="mainFrame">
<div class="buttonFrame">
<a class="button Home buttonEffect" title="Home">Home</a>
<a class="button Notes buttonEffect" title="Notes">Notes</a>
<a class="button AboutMe buttonEffect" title="About Me">About Me</a>
</div>
<div class="contentFrame">
</div>
</div>
</body>
</html>