Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

HTML & CSS Header fixed on top while scrolling

Hi,

For a school assignment i have to fix my header on top but when i use my code it gets messed up and lands somewhere in the middle of the page.

Code:
#h1 {
    color: white;
    background-color: hsl(63, 56%, 38%);
    border-style: dotted;
    border-color: black;
    padding: 50px;
    text-align: center;
    position: fixed;
    bottom: 20px;
}
 
Hi,

For a school assignment i have to fix my header on top but when i use my code it gets messed up and lands somewhere in the middle of the page.

Code:
#h1 {
    color: white;
    background-color: hsl(63, 56%, 38%);
    border-style: dotted;
    border-color: black;
    padding: 50px;
    text-align: center;
    position: fixed;
    bottom: 20px;
}


Update:

So i have fixed the header but now it overlaps my .main {}.

Code:
#h1 {
    color: white;
    background-color: hsl(63, 56%, 38%);
    border-style: dotted;
    border-color: black;
    padding: 50px;
    text-align: center;
    position: fixed;
    left: 210px;
    bottom: 460px;
}

#main{
    border-color:hsl(63,56%,10%);
    border-style: solid;
}
 
Can I see some HTML?
Yes, of course.

I chose to delete my css file and read the books again, make notes etc and try it again after that..

I will be a master coder one day i have promised myself haha






Code:
<body>
<header>
    <h1 id="h1">Als we alles zouden toepassen wordt het een zooitje</h1>
</header>
<main id="main">
    <article class="article">
        <h2>Maak de schaduw op elementen nooit te heftig</h2>
        <div class="circle-one"></div>
        <div class="circle-two"></div>
    </article>
    <article class="article">
        <h2>Gebruik niet zoveel verschillende borders als hier</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
            magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
            commodo consequat. </p>
    </article>
    <article class="article">
        <h2>Lorum ipsum dolor</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
            magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
            commodo consequat. </p>
    </article>
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom