Creating a 3-row design with a customized login box using HTML elements, div blocks, and CSS

I would like to use HTML, CSS and DIVs to create a 3-row layout similar to the one shown here.

Specifically, I want to include a signin-box with a fixed width in the top right of the first row.

This is what I have tried:

<div id="container">
    <div id="top">
        <div id="header"></div>
        <div id="signin"></div>
    </div>
    <div id="content"></div>
    <div id="footer"></div>
</div>

body {
    margin:0;
    padding:0;
}
div#top {
    position:fixed;
    width:100%;
    height:65px;
    z-index:100;
    background-color:#AAA;
}
div#header {
    width:100%;
    height:65px;
    background-color:#F00;
    float:left;
}
div#signin {
    width:100px;
    height:65px;
    background-color:#0F0;
    float:right;
}
div#footer {
    width:100%;
    height:65px;
    position:fixed;
    bottom:0;
    background-color:#06F;
}
div#content {
    background-color:#111;
    width:100%;
    height:100%;
    position:absolute;
}

Unfortunately, the login box ends up below the first row instead; you can see it here.

Any suggestions on how I can properly position the login box to the right of the first row? Thank you in advance!

Answer №1

Make sure to include position:absolute; and right:0px; in the signin selector. You can try the following code:

div#signin {
    width:100px;
    height:65px;
    background-color:#0F0;
    position: absolute;
    right:0px;
}

Check out the DEMO here

Answer №2

Easy task: reposition the signin div inside the header section

<div id="container">
    <div id="top">
        <div id="header">
            <div id="signin"></div>
        </div>

    </div>
    <div id="content"></div>
    <div id="footer"></div>
</div>

Answer №3

If you want to include your login form within the header section, simply place

<div id="signin"></div>
inside
<div id="header"></div>

<div id="header">
  <div id="signin"></div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Retrieve the genuine HTML code for a control directly on the client side

My goal is to retrieve the complete HTML text for a control from the client browser. This is important because certain information, especially the "Style," does not appear on the server side. How can I obtain the entire HTML text for a control? ...

Steps to insert a logo into a Bootstrap navbar

Hey there, I'm having trouble fitting my logo into a Bootstrap navbar. The issue is that the logo appears larger than the navbar itself, and I've tried various solutions without success. Can someone please assist me with this problem? Below is th ...

Tips for speeding up the loading time of a webpage with sluggish social media content

Currently, I am experiencing slow loading times for social media icons on my website. The code for these buttons is located near the top of the page, causing a delay in loading other elements. Is there a way to position the buttons where I want them to ap ...

JavaScript Empty Input Field when Duplicating Node

I am seeking advice on how to clear the textboxes when an HTML form is cleared. The following JS code runs onclick: var counter = 0; function moreField() { counter++; var newFields = document.getElementById('readroot').cloneN ...

What is the best way to incorporate the icon directly from the .svg sprite into CSS/SCSS?

An irate customer is demanding that I use all icons inside an SVG file according to 2023 standards. This includes icons for background images and normal icons that can be easily changed. I currently utilize an SVG sprite in the following format: <?xml ...

How can I position the nav-item to the right without it becoming collapsed?

Hello! I am currently using Bootstrap 4 and attempting to create a navbar menu. Below is the code I have written: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <button class="navbar-toggler" type="button" data-toggle="collapse" da ...

Tips for creating a square HTML element

Looking to customize my react calendar with square tiles. Currently, the width is determined by the overall calendar width, but I want the height to match. https://i.sstatic.net/3vVrq.png Sample HTML: <button class="react-calendar__tile react-cal ...

Learn how to automatically navigate to another page upon successfully creating an account and setting a value in the Firebase database

I am working on a system where, after successfully creating an account and setting a value in Firebase database, the user will be redirected to another page. Currently, I have managed to navigate to the next page but I am facing an issue with setting the ...

I've been attempting to align the iframe element in the center without success, despite trying out various solutions from

Despite trying to center-align the div using style="text-align: center;", display: block, and align="center", none of these methods seemed to work for me. Here is the code including all attempts: <div align="center" style="text- ...

Challenges arising from updating the size and position of a div element during a mouse move event

As I work on creating a basic horizontal split pane using HTML, CSS, and JavaScript, I have drawn inspiration from this post. While the vertical split pane functions smoothly, the horizontal version seems to be glitchy. The sizes and positions of the div ...

Protected login form

I've designed a login form that prompts users to enter their username and password in order to access index.php. Additionally, I have authenticate.php set up, which is required by index.php to prevent unauthorized access. However, I'm struggling ...

Enhance user experience with jQuery UI sortable and the ability to edit content in real

I am facing an issue with jquery sortable and contenteditable. The problem arises when I try to use jquery sortable along with contenteditable, as the contenteditable feature stops working. After searching on Stack Overflow, I found a solution. However, up ...

Troubleshooting display problems with the categories menu in Opencart version 1.5.1 caused by IE

For our opencart website, we utilize the li element for the sub categories items. displays properly on all modern browsers. However, we need to ensure compatibility with Internet Explorer 6 as well. ...

Click on a hyperlink to open a fresh page in a separate tab using Google Chrome

Is there a way to open a link in a new tab instead of a new window on ajax success in Chrome using jQuery or JavaScript? Here is the code snippet: $("#A1").click(function (event) { $.ajax({ type: "POST", url: "Home.aspx/btnTestProje ...

Discover the method for two form fields to submit data to a distant page, located two pages away

Currently, I'm trying to figure out the best approach for having two fields submitted to a page that is located two pages away. To provide more context, let me elaborate on the situation. On the initial page, there will be two fields - workshop title ...

When utilizing JSON data to bind HTML in Angular.js, the select option values may end up returning null

My challenge involves dynamically binding an HTML form stored as JSON into a view template using a custom directive. This HTML form includes a select tag and options that are generated dynamically using ng-repeat, with their models set using ng-model. Th ...

Maintain the layout of HTML page while reducing the window size

My webpage is experiencing an issue. When I resize the window, the placement of all elements becomes misaligned and the layout gets distorted. ...

Using the ico-moon icon in an HTML email for various email clients such as Outlook and Gmail

I would greatly appreciate it if someone could provide instructions on how to incorporate ico-moon icons into an email HTML, ensuring they can be properly displayed in various email clients such as Outlook and Gmail. ...

Having trouble getting $compile to work in an injected cshtml file with Angular

Summary I am currently working on a large application where everything is designed to be very generic for easy expansion. One of the components I am focusing on is the dialog. Before suggesting alternatives like using ngInclude or angular templates, let m ...

Incorporate an XNA game directly into a website

Is it possible to launch an XNA game directly from a web page without the need for any installations? Something along the lines of Java, Silverlight, or similar to WPF Browser Applications (XBAP). Situation: Visit a webpage, Prompted to install the g ...