Combining both responsive and nonresponsive code on a single webpage

The project I am currently working on is a massive website that we cannot tackle all at once. As a result, we are developing it in phases. The challenge we are facing is transitioning from a 1990s table-based structure to a modern Bootstrap-divs responsive design. This means that consistency is key when we release each phase, ensuring that the appearance remains uniform across the entire site.

In essence, the header and footer need to maintain a consistent look and functionality between non-responsive (table-based) and responsive (Bootstrap) pages. While the header has already been made responsive, the rest of the site is not yet coded in a responsive manner.

My current issue lies in the fact that the header, fixed to the top of the page, is responsive. However, since the page content lacks responsive coding, a scrollbar appears at the bottom. Additionally, my footer, which needs to stay at 100% width and remain fixed at the bottom, is refusing to cooperate without compromising its responsiveness.

I have created a codepen to illustrate this issue using a basic vanilla page. You can view it here

Here is the CSS code for the footer:

footer{
   width:100%;
   background:#ddd;
   height:35px;
}

Strangely, applying position: absolute and bottom:0 to the footer, which should keep it at the bottom of the page, actually causes it to move to the center instead!

Answer №1

That's a revolting one.

To avoid the issue of non-responsive page content causing a horizontal scroll bar at the <body> level, it is recommended to enclose it within another element. This will enable only that specific element to scroll horizontally.

While this solution may not be perfect, it can serve as a temporary workaround until the entire site is made responsive.

.page-content-wrap {
  max-width: 100%;
  overflow-x: scroll;
}
.page-content {
  padding-top: 70px;
  width: 1170px;
  margin: 0 auto;
}
footer {
  width: 100%;
  background: #ddd;
  height: 35px;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />

<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Project name</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a>
        </li>
        <li><a href="#about">About</a>
        </li>
        <li><a href="#contact">Contact</a>
        </li>
        <li class="dropdown">
        ...
      </ul>
    </div>
    <!--/.nav-collapse -->
  </div>
</nav>

<div class="page-content-wrap">
  <div class="page-content">
    <div class="box">
      <h1>Navbar example</h1>
      <p>This example is a quick exercise to illustrate how the default, static and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
        ...
    </div>

  </div>
  <!-- /container -->
</div>

<footer>
  <div class="container">
    Footer
  </div>
</footer>

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

Determine if the data in an HTML table should be spanned when it

I'm facing a scenario where my HTML table contains duplicate data in a particular column, as illustrated below I am looking to automatically merge the cells of rows in the HTML table if the data in them is identical, similar to the table displayed be ...

Challenges arise when creating responsive map regions in Vue 3

I am currently working on a project in Vue 3 that involves an image map with click events on certain areas. The challenge I'm facing is that the images scale according to the browser size, but the coordinates of the image map are fixed pixel sizes. I& ...

How can I create multiple vertical lines in an SVG format?

How can I achieve an effect similar to this https://i.sstatic.net/ulZFR.png? I have attempted using strokeDashoffset and strokeDasharray, but I am still unable to achieve the desired result. I know that I can draw multiple lines, but I need a script that ...

Enclose elements in a div using a jQuery each function

I have successfully parsed data from an XML feed to JSON, but now I want to wrap each part of the data within a div. Here is the code snippet I am working with: var newsDiv = $('<div class="news-feed">').appendTo($("body")); $(release ...

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 ...

What steps can I take to ensure the browser only shows the page once it has completely loaded?

I find it frustrating when webpages load slowly and you can see the process happening. In my opinion, it would be more satisfying to wait until everything is fully loaded - scripts, images, and all - before displaying the page. This brings up two questio ...

What is the efficient way to toggle localStorage based on checkbox selection using jquery?

I am looking to efficiently manage localStorage using checkboxes. When a checkbox is checked, I want to add the corresponding value to localStorage, and remove it when unchecked. var selectedModes = new Array(); $('.play_mode').on('click& ...

Original text: Default SVG styleRewritten text

Could you please provide information on the default style of SVG? For instance, what is the default font used in a new SVG document? Is this specified in the SVG specifications? <svg><text x="10" y="10">Hello</text></svg> Thank yo ...

Initial loading issue with HTML5 Canvas in Android WebView

As I work on developing a HTML5 canvas-based game within a WebView of an existing application, I encounter a puzzling issue. Upon the initial run of the game, everything seems to be in order - logs indicate that it's ready and running, yet nothing is ...

What steps can I take to ensure my CSS component remains unaffected by the global CSS styles?

My navbar component is not displaying the styles correctly as intended. I have a Navbar.module.css file to style it, but after using next-auth for social login, only the buttons remain unstyled while everything else gets styled. The code snippet for impor ...

Automatically selecting and fetching checkbox values using JavaScript

I was struggling with coding a function that involved generating checkboxes using JavaScript. My goal is to automatically select the elements "March" and "September" from the array target[] and display them as checked in the text area. So, "March" and "Se ...

Understanding Arrays in Angular JSIn this article, we

I am new to working with Angular JS. Currently, I am populating an array and attempting to showcase its contents on the HTML page using ng-repeat. $scope.groupedMedia = []; // Elements are being added through a for loop. $scope.groupedMedia[year].push(r ...

Tips for hiding the overflow scrollbar on Microsoft Chrome when there is no content to scroll

Looking for a solution to hide scroll bars in Microsoft Chrome, but only when there is no content to scroll? The current div and styles always show the horizontal and vertical scroll bars, even when the height exceeds the content. <div style="backgroun ...

My approach to using this style in React involves utilizing the class attribute as follows: "class[attribute]" [Updated version 2]

When trying to customize an element based on its attribute, the process is a bit different in React compared to pure CSS. Here's an example: <div class='something' data-test='4'></div> ... .something[data-test] { bac ...

Issues persist with jQuery ajax request attempting to retrieve data from database

I attempted to retrieve data from my database using jQuery AJAX. Below is the code snippet I used: <script> $(document).ready(function(){ function fetch_data(){ $.ajax({ type:"POST", url:"http://localhost:88/phpPoint/select.php", success:function(re ...

Interactive Table - Enhance Your Searching Experience with jQuery

Recently, I've been tackling a Live Search solution for my data table. Success! When searching for Jim, everything works flawlessly. ...

Exploring the techniques for displaying and concealing div elements with pure JavaScript

Here's an example of code I wrote to show and hide div elements using pure JavaScript. I noticed that it takes three clicks to initially hide the div elements. After that, it works smoothly. I was attempting to figure out how to display the elements ...

Looking to enhance your front-end assets with Bootstrap js plugins in the brunch-config.js file?

I'm trying to incorporate Bootstrap's alert.js plugin as a front-end asset, but I'm having trouble getting it to work using brunch-config.js and npm. In my current brunch configuration (which includes adding jQuery and Bootstrap CSS to asse ...

Click on the print icon in the modal window

I have been working on a receipt generator for a client. The client can add payment receipts using the "Add" button, and upon submission, they have the option to convert it to PDF or print it. However, there seems to be an issue with printing as the text f ...

Creating a visual comparison by using knockout side by side

I'm currently working on a project that requires me to display multiple items side by side for comparison. The ideal layout would be similar to Amazon's, where each item is represented by a vertical column with all relevant information about tha ...