Struggling with organizing the layout of your HTML page? Let us lend

I am having difficulty with the layout of a page I'm working on. The lower page navigation is not positioning properly - it wraps below the left column instead of staying below the data columns. Additionally, the border for the navigation appears at the top of the page instead of around the navigation itself. Finally, the footer is displaying at the top of the page rather than at the bottom. I've been trying to troubleshoot this for over a day now and can't seem to find where I went wrong.

Here's a simplified version of the code:

.h2b {
  /*page title*/
  font-size: 17.5pt;
  color: #469;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
}
.a {
  color: #469;
  text-decoration: none;
}
body {
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: small;
  font-style: normal;
  background-color: #fff;
}
#container {
  width: 100%;
  margin: 0;
  background-color: #fff;
  position: relative;
  padding: 0;
}
#masthead {
  text-align: right;
  width: 100%;
  background-color: #c5d5e5;
  /*width: auto;*/
  margin: 0;
  padding: 0;
  overflow: auto;
}
#page_content {
  position: relative;
  width: 96%;
  /*width: 98%;*/
  /*border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCAA77;*/
  left: 20px;
}
#major_revision {
  
}
#footer {
  background-color: #dfcfbf;
  padding-bottom: 5px;
  width: auto;
  clear: both;
  overflow: auto;
}
#masthead img {
  float: left;
  margin: 0;
  padding: 0;
}
#masthead p {
  font-size: small;
  text-align: right;
  color: #000;
  margin: 0 0 0 0;
  padding: 0;
}

/* Styles for Navigationcommon modified 10-16-2015*/

#navigationcommon {
  background-color: #548EBE;
  overflow: hidden;
  border-bottom: thin black solid;
}
#navigationcommon ul {
  list-style-type: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
#navigationcommon li {
  float: left;
}
#navigationcommon a {
  color: #FFF;
  text-decoration: none;
  display: block;
  padding: 5px;
  border: 1px solid #D3D3D3;
  background-color: #548EBE;
}
#navigationcommon a:hover {
  color: #000;
  text-decoration: none;
  border: 1px solid #D3D3D3;
  background-color: #ADD8E6;
}

/* Styles for Footer */

#footer p {
  font-size: x-small;
  text-align: center;
  color: #393939;
  margin: 10px;
  padding: 1px;
}
#footer a {
  color: #393939;
  text-decoration: underline;
}
#footer a:hover {
  color: #000;
  text-decoration: none;
}
<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta charset="UTF-8">

  <title>PAGE</title>


</head>

<body>

  <!-- Begin Container -->
  <div id="container">

    <!-- Begin Masthead -->
    <header id="masthead" onclick="" style="background-color:#0047ff">
      <p style="background-color:#0047ff;height:30px; width:104px">
        <!--See helper file for paths to image files-->
      </p>
    </header>
    <!-- End Masthead -->
    <nav id="navigationcommon" onclick="">
      <ul>
        <!--See helper file for paths to image files-->
        <li><a href="#">Home</a>
        </li>
        <li><a href="#">About</a>
        </li>
        <li><a href="#">Contacts</a>
        </li>
        <li>
          <a href="#" onclick="passdata(); return false">Improve</a>
        </li>
        <li><a href="#">Tailor</a>
        </li>
      </ul>

      <a href="#" style="float:right;font:small-caption;border-style:none;
color:white; vertical-align:bottom;margin-bottom:0px;padding-bottom:0px;padding-left:5px;padding-right:5px">Advanced Search</a>
      <!--See helper file for paths to image files-->
      <input type="image" src="pill-button-green-clip-art.jpg" style="width: 90px; border-style:none; float:right; height: 28px;" value="Search" onclick="search()">&nbsp; &nbsp; &nbsp;
      <input name="search" type="text" maxlength="512" id="search" class="searchField" title="" style="width: 300px; 
border-style:none; height: 26px; float:right; padding-right:5px; " value="Enter Keyword">&nbsp; &nbsp; &nbsp;
    </nav>

    <!-- Begin Page Content -->
    <section id="page_content" style="top: 60px;" onclick="">
      <div id="major_revision" style="position:fixed;top: 65px;float:left;width:100%;padding: 0 1% 1% 2%;">
     
      </div>

    
      
        </div>

       
      </div>

     
   

    </section>
    <!-- Begin Footer -->
    <div id="footer">
      <p>Copyright &copy; All Rights Reserved.</p>
    </div>
    <!-- End Footer -->

  </div>
  <!-- End Container -->

</body>

</html>
​

Answer №1

If you are currently in the process of creating a sophisticated application with complex design elements, I suggest utilizing absolute layouts:

http://codepen.io/anon/pen/BomePK

<div class="l-header">Header</div>
... (similar code with slight adjustments) ...
<div class="l-footer">Footer</div>


.l-header        { width:100%; height:20px; top:0; left:0; position:absolute; background:orange; }
.l-navigation    { width:100%; height:20px; top:20px; left:0; position:absolute; background:green; }
... (some CSS styles modified) ...

<p>This layout will function well on tablet-sized screens, but given the expected complexity of your application, it may not be sufficient. It's advisable to reconsider the user experience aspect for smooth operation on mobile devices.</p>

<p>Furthermore, moving your inline CSS to an external stylesheet is highly recommended.</p>
    </div></answer1>
<exanswer1><div class="answer chosen" i="33217212" l="3.0" c="1445254553" a="TG93a2FzZQ==" ai="981047">
<p>It seems like you are working on a high-level application, and based on the intricate complexity displayed in your design, I recommend opting for absolute layouts:</p>

<p><a href="http://codepen.io/anon/pen/BomePK" rel="nofollow">http://codepen.io/anon/pen/BomePK</a></p>

<pre><code><div class="l-header">Header</div>
... (similar code with slight adjustments) ...
<div class="l-footer">Footer</div>


.l-header        { width:100%; height:20px; top:0; left:0; position:absolute; background:orange; }
.l-navigation    { width:100%; height:20px; top:20px; left:0; position:absolute; background:green; }
... (some CSS styles modified) ...

<p>This layout will work effectively on tablet-sized screens, however, considering the complexity expected in your application, it may fall short. It would be wise to reassess the user experience aspect to ensure seamless functionality on mobile devices.</p>

<p>In addition, transferring your inline CSS to an external stylesheet is strongly advised.</p>
    </div></answer1>
<exanswer1><div class="answer chosen" i="33217212" l="3.0" c="1445254553" a="TG93a2FzZQ==" ai="981047">
<p>It appears that you are developing a complex application, and based on the intricacy of your design, I recommend using absolute layouts:</p>

<p><a href="http://codepen.io/anon/pen/BomePK" rel="nofollow">http://codepen.io/anon/pen/BomePK</a></p>

<pre><code><div class="l-header">Header</div>
... (similar code with slight adjustments) ...
<div class="l-footer">Footer</div>


.l-header        { width:100%; height:20px; top:0; left:0; position:absolute; background:orange; }
.l-navigation    { width:100%; height:20px; top:20px; left:0; position:absolute; background:green; }
... (some CSS styles modified) ...

<p>This layout will be suitable for tablet-sized screens, but the anticipated complexity in your application may require more. It's recommended to review the user experience aspect to ensure optimal performance on mobile devices.</p>

<p>Additionally, consider relocating your inline CSS to an external stylesheet.</p>
    </div></answer1>
<exanswer1><div class="answer chosen" i="33217212" l="3.0" c="1445254553" a="TG93a2FzZQ==" ai="981047">
<p>It looks like you're embarking on building a sophisticated application, and judging by the level of complexity in your design, I advise utilizing absolute layouts:</p>

<p><a href="http://codepen.io/anon/pen/BomePK" rel="nofollow">http://codepen.io/anon/pen/BomePK</a></p>

<pre><code><div class="l-header">Header</div>
... (similar code with slight adjustments) ...
<div class="l-footer">Footer</div>


.l-header        { width:100%; height:20px; top:0; left:0; position:absolute; background:orange; }
.l-navigation    { width:100%; height:20px; top:20px; left:0; position:absolute; background:green; }
... (some CSS styles modified) ...

<p>This layout will adapt well to tablet-sized screens, but with the expected complexity in your application, it may not suffice. Consider revisiting the user experience aspect for smooth operation on mobile devices.</p>

<p>Moreover, transitioning your inline CSS to an external stylesheet is highly advisable.</p>
    </div></answer1>
<exanswer1><div class="answer chosen" i="33217212" l="3.0" c="1445254553" a="TG93a2FzZQ==" ai="981047">
<p>You seem to be working on a complex application, and typically, I advocate for using absolute layouts given the intricate nature of your design:</p>

<p><a href="http://codepen.io/anon/pen/BomePK" rel="nofollow">http://codepen.io/anon/pen/BomePK</a></p>

<pre><code><div class="l-header">Header</div>
... (similar code with minor modifications) ...
<div class="l-footer">Footer</div>


.l-header        { width:100%; height:20px; top:0; left:0; position:absolute; background:orange; }
.l-navigation    { width:100%; height:20px; top:20px; left:0; position:absolute; background:green; }
... (slight adjustments in CSS styles) ...

<p>This design will adjust well to tablet-sized screens, but given the complexity expected in your app, it might not be adequate. Revisiting the user experience aspect to ensure effective functioning on mobile devices is crucial.</p>

<p>Also, consider moving your inline CSS to an external stylesheet for better organization.</p>
    </div></answer1>
<exanswer1><div class="answer chosen" i="33217212" l="3.0" c="1445254553" a="TG93a2FzZQ==" ai="981047">
<p>It appears that you are developing a sophisticated application, and based on the intricate design you have implemented, my suggestion is to utilize absolute layouts:</p>

<p><a href="http://codepen.io/anon/pen/BomePJ" rel="nofollow">http://codepen.io/anon/pen/BomePJ</a></p>

<pre><code><div class="l-masthead">Masthead</div>
<div class="l-navigation">Navigation</div>
<div class="l-revision">Revision</div>
<div class="l-pagenav-top">Page Navigation Top</div>
<div class="l-data">
  <div class="l-data-con">
    <div class="l-data1">
      <p>
        Lorum1
      </p>
      <p>
        Lorum2
      </p>
      <p>
        Lorum1
      </p>
      <p>
        Lorum1
      </p>
      <p>
        Lorum1
      </p>
    </div>
    <div class="l-data2">
      <p>
        Lorum1
      </p>
      <p>
        Lorum2
      </p>
      <p>
        Lorum1
      </p>
      <p>
        Lorum1
      </p>
      <p>
        Lorum1
      </p>     </div>
   </div>  
</div>
<div class="l-pagenav-bot">Page Navigation Bottom</div>
<div class="l-footer">Footer</div>


.l-masthead      { width:100%; height:20px; top:0; left:0; position:absolute; background:orange; }
.l-navigation    { width:100%; height:20px; top:20px; left:0; position:absolute; background:green; }
.l-revision      { width:100%; height:20px; top:40px; left:0; position:absolute; background:lime; }
.l-pagenav-top   { width:100%; height:20px; top:60px; left:0; position:absolute; background:yellow; }

.l-data          { width:100%; position:absolute; top:80px; bottom:40px; left:0; }
.l-data-con      { width:100%; height:100%; position:relative; }
.l-data1         { padding:20px; overflow-y:auto; position:absolute; top:0; right:50%; bottom:0; left:0; background:LightBlue; }
.l-data2         { padding:20px; overflow-y:auto;position:absolute; top:0; right:0; bottom:0; left:50%; background:LightCyan; }

.l-pagenav-bot   { width:100%; height:20px; position:absolute; bottom:20px; left:0; background:yellow; }
.l-footer        { width:100%; height:20px; position:absolute; bottom:0; left:0; background:orange; }

This layout will be responsive up to a tablet size, but beyond that, considering the complexity expected in your app, it may not be sufficient. You may need to revisit the user experience to ensure proper functionality on phones.

Furthermore, shifting your CSS from inline to an external file is recommended for better management.

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

Utilize the :not() and :hover selectors in Less when styling with CSS

Some of my elements have a specific class called .option, while others also have an additional class named .selected. I want to add some style definition for the :hover state on the .option elements, but only for those without the .selected class. I' ...

The dropdown menu fails to update in Internet Explorer

Here is the URL for my website: . On this page, there are two fields - category and subcategory. When a category is selected, the corresponding subcategory should change accordingly. This functionality works smoothly in Google Chrome, however it encounte ...

Exploring the implementation of a many-to-many relationship on a webpage

In the process of creating a library database and dealing with a many-to-many relationship between books and writers, I am contemplating how best to design the user interface for managing this information. When editing a book entry, selecting one or more ...

Addressing three visual problems with an html form input, dropdown menu, and clickable button

Currently, the output of my code looks like this: https://i.stack.imgur.com/pl5CJ.jpg The first box (squared) represents an <input>, while the second box (rectangled) is a <select>. There are several issues that I am facing: The text entered ...

How to Keep Button Highlighted After Clicking

I've experimented with various methods like using :active, :focus, adding a class, and modifying CSS rules through jQuery to maintain the button highlight, but none of them have been successful. Please take a look at my code and point out any mistakes ...

Text located incorrectly beside image within container box

Below is the HTML code that defines a box containing title text and an image. <div id="about"> <div id="title"> <h3><b>About</b></h3></div> <div id="text"><p>Text</p></div> <div id="img ...

Sending the slider value from a website to a program when the slider is adjusted

I have been experimenting with programming an ESP32 to regulate the LED brightness using a slider. I've pieced together some information from tutorials found on and Currently, I've achieved the ESP32 connecting to my network, displaying the sli ...

What is the best way to hide only the rows in a table when it is clicked using JavaScript?

Is there a way to hide rows in these tables by clicking on the table head? I'm currently using bootstrap 5 so JQuery is not an option. <table class="table table-info table-bordered"> <thead id="tablea"> ...

Tips on traversing a JSON array in AngularJS using the ng-repeat directive

My service returns the following JSON data: {"categories":[{"category_id":"20","name":"Desktops"}, {"category_id":"18","name":"Laptops &amp;"},{"category_id":"25","name":"Components"}, {"category_id":"57","name":"Tablets"}, {"category_id":"17","name": ...

Using Selenium to scroll down to an element until its 'style' changes

I'm in the process of scraping a review page similar to this one. While this specific page has only a few reviews, there are others with a larger volume that require extensive scrolling. Upon observation, I noticed that when the page is not complete ...

The issue of try-catch not functioning properly within a recursive function

Goal My objective is to capture the "Failed to load resource" error and display it in an alert window. Problem I am attempting to handle a video that does not exist. The try catch block is not catching the exception. Scenario I am working on playing vide ...

Manipulating the distinct look of the final element in an *ngFor loop

I am trying to enhance the appearance of the last line of controls generated by an iterator by making it disabled and somewhat invisible. Currently, my code is functioning well, as shown below. <div *ngFor="let item of data; let last = last;"> &l ...

Adjust the color of a label based on a set threshold in Chart.js

Can anyone help me with my Chart.js issue? Here is a link to the chart: I am trying to change the color of the horizontal label when it falls between 70.00 - 73.99. Does anyone know if there's a specific option for this in Chart.js? Thanks! ...

How much does it typically cost to implement external libraries into a project?

Here are some of the most commonly used front-end web development libraries: jquery-min.js (95.9 kB) angular.min.js (108.0 kB) bootstrap.min.css (113.5 kB) bootstrap-theme.min.css (19.8 kB) bootstrap-fonts (185.7 kB) bootstrap.min.js (35.6 kB) All in al ...

Capturing the action phase in Liferay to change the cursor to 'waiting' mode

I'm currently working on a large Liferay project and have encountered a specific issue: Whenever something in the system is loading or processing, I need to change the cursor to a waiting GIF. While this is simple when using Ajax, there are many inst ...

What is the default margin for Autocomplete in Material UI?

Having just started with material-ui, I'm having trouble figuring out the margins of the Autocomplete. My form includes both Autocomplete and TextInput elements, but their positioning seems off to me. Is there some predefined margin box around Autocom ...

Tips for retrieving the option text value following an onchange event in AngularJS

Whenever I change the selection in my dropdown menu for 'Cities', the alert is displaying the value of the previous selection instead of the current one. For example, if I select a state and then switch to Cities, the alert shows the text related ...

Help needed with debugging CSS for IE6 >_<

I have been working on the following website: www.darksnippets.com While the design looks good on Firefox and Chrome, it appears terrible on IE6. For example, on the home page and other pages like , the width is too wide in IE6. I've been unable to ...

What strategies can be used to avoid a single dangling word at the end of a line within an HTML element?

I am in the process of developing a straightforward webpage with marketing content. One aspect I find unfavorable is when a line of text stretches too long and breaks onto the next line, which is acceptable; however, it often splits in a manner where there ...

Create a new NVD3 graph with a vertical line added

I am working with a NVD3 graph that displays a simple data set. My goal is to draw a line over the graph in a different color (similar to a cut-off value, which will be at x=5) <meta http-equiv="content-type" content="text/html; charset=UTF8"> <s ...