Skip to content

How to fix the menu at a distance of 100px #103242

Closed Answered by UdaySMukherjee
ToitenAn asked this question in Accessibility
Discussion options

You must be logged in to vote

HTML (index.html):
Create a new file named index.html and copy the HTML content into it.

<title>Fixed Menu Example</title>
<!-- Your page content goes here -->
<div id="content">
    <!-- ... -->
</div>

<script src="script.js"></script>
CSS (styles.css): Create a new file named styles.css and copy the CSS content into it.

/* styles.css */
body {
margin: 0;
padding: 0;
}

#fixed-header {
position: fixed;
top: -100px; /* Initially hide the menu above the viewport /
left: 0;
width: 100%;
background-color: #333; /
Choose your background color /
padding: 10px 0; /
Adjust padding according to your design /
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /
Optional: Add a subtle …

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies

This comment was marked as off-topic.

Comment options

You must be logged in to vote
0 replies
Answer selected by ToitenAn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Making GitHub useable for members of the disability community Question
6 participants