The footer size appears inadequate on Chrome browser

Observing the element footer.mdl-mini-footer, I found that all the provided sizes were measured using F12 developer tools in Responsive Mode with a screen size of 768x884 (Chrome's Tablet breakpoint size).

In Firefox, the element footer.mdl-mini-footer has dimensions of width: 736px; height: 36px;.

In Chrome, the element footer.mdl-mini-footer has dimensions of width: 736px; height: 10.438px;.

The crucial aspect is the difference in height. In both browsers, the child element ul.mdl-mini-footer__link-list has dimensions of width: 268px; height: 36px;, leading to the footer's content sinking below the footer element.

It's worth noting that the style="padding: 8px 16px" on the footer element is not necessary for this issue to arise. It simply highlights the problem by reducing the default padding provided by Material Design Lite of 32px 16px. Specifically, the problem is that the footer's height decreases in Chrome as the content on the page requires more scrolling. This does not occur in Firefox, which is the intended behavior.

For thoroughness, I also tested the page in Microsoft Edge, which behaves exactly like Firefox. Additionally, adjusting Chrome's zoom level to 125% to align it better with Firefox's zoom level only worsens the issue, resulting in a new footer height of 8.297px.

Why does this discrepancy only occur in Chrome, and how can it be prevented?

Stack Snippet in Firefox: https://i.sstatic.net/mIma1.png

Stack Snippet in Chrome: https://i.sstatic.net/RwAiF.png

<!DOCTYPE html>

<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <!-- Material Design Lite -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.deep_purple-blue.min.css">
  <script defer="" src="https://code.getmdl.io/1.1.3/material.min.js"></script>
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
</head>

<body>
  <div class="mdl-layout__container">
    <div class="mdl-layout mdl-js-layout">
      <main class="mdl-layout__content">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas, magna ac ultrices hendrerit, risus lorem accumsan justo, at finibus orci odio at sapien. Morbi eu placerat nisl. Nunc rhoncus ut risus nec eleifend. Nulla facilitransicion. Morbi eget molestie magna. Duis quis neque interdum, elementum risus ac, interdum urna. Nunc fermentum
          non nulla vel pharetra. In ullamcorper ac ipsum ut convallis. Morbi bibendum nisi vitae quam commodo porta.</p>
        <p>Nam facilisis finibus libero vel consequat. Cras eu magna in dui ullamcorper aliquet nec vestibulum mi. Nam rutrum justo ac risus imperdiet consectetur. Donec pellentesque sapien nec euismod ullamcorper. Nam efficitur quam vitae justo convallis,
          a aliquet justo finibus. Pellentesque auctor finibus neque sed dapibus. Ut maximus interdum risus ut viverra. Quisque varius, augue et cursus efficitur, nisl arcu maximus sapien, vel tempor erat elit at turpis. Nullam imperdiet urna eget elit
          dignissim, ut feugiat nibh lacinia. Aliquam vel cursus est. Praesent tristique mauris a ex viverra, at vehicula nibh laoreet.</p>
        <p>Curabitur lacinia, justo ac placerat porta, lectus nulla aliquam nisi, sit amet elementum enim ipsum vitae tortor. Donec eu ultrices tellus. Nam et quam nisl. Nulla facilisi. Donec turpis velit, tristique et ultrices sit amet, blandit vel tellus.
          Nam ultricies posuere odio in pretium. Integer semper, lacus at pulvinar condimentum, nibh nibh ornare dui, vel tincidunt mauris turpis at sapien. Nunc ultrices sollicitudin diam ut semper. Nulla quis quam fringilla, pretium erat eu, hendrerit
          tellus. Ut la...

Answer №1

Make sure to place the footer inside the <main> section. Keep all page content within the mdl-layout__content element to avoid any issues with the layout javascript causing unexpected behavior.

Answer №2

The solution I came up with maintains the "fixed footer" feature that I originally had in mind. This ensures that the footer always stays at the bottom of the screen, regardless of the amount of content on the page.

In a response by Garbee, a maintainer for MDL, it is recommended to place the footer within the content element. While this layout is officially supported, it causes the footer to be displayed at the bottom of the page, which is not the behavior I was looking for.

After experimenting with various sticky and fixed footer solutions, I discovered that setting a flex value of 0 0 auto on the footer element made Chrome behave more like Firefox in this scenario. The issue stemmed from Chrome shrinking the footer with a flex-shrink of 1, whereas Firefox did not. Since the default value of flex is 0 1 auto, this caused the footer to appear distorted on Chrome but not on Firefox in this context.

In summary:

.footer {
    -webkit-flex: none;
    -ms-flex: none;
    flex: none;
}

.footer {
  -webkit-flex: none;
  -ms-flex: none;
  flex: none;
}

<!-- begin snippet: js hide: true console: true -->
<!DOCTYPE html>

<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <!-- Material Design Lite -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.deep_purple-blue.min.css">
  <script defer="" src="https://code.getmdl.io/1.1.3/material.min.js"></script>
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
</head>

<body>
  <div class="mdl-layout mdl-js-layout">
    <header class="mdl-layout__header"></header>
    <div class="mdl-layout__drawer"></div>
    <main class="mdl-layout__content">
  // Content continues...
    </main>
    <footer class="mdl-mini-footer" style="padding:8px 16px;">
      <div class="mdl-mini-footer__right-section">
        <ul class="mdl-mini-footer__link-list">
          <li>
            <img alt="GitHub" height="32" src="https://raw.githubusercontent.com/CAD97/SO-resources/9ca92a11babb0766580e511d8473b960c040cc91/01/github-32x32.png">
          </li>
          <li>
            <img alt="YouTube" height="32" src="https://raw.githubusercontent.com/CAD97/SO-resources/9ca92a11babb0766580e511d8473b960c040cc91/01/youtube-45x32.png">
          </li>
          <li>
            <img alt="Twitter" height="32" src="https://raw.githubusercontent.com/CAD97/SO-resources/9ca92a11babb0766580e511d8473b960c040cc91/01/twitter-39x32.png">
          </li>
        </ul>
      </div>
    </footer>
  </div>
</body>

</html>

Answer №3

If the content within the mdl-layout_content does not extend enough to require scrolling, Garbee's solution does not adequately address the issue. In such cases, the mdl-mini-footer may not be positioned at the bottom of the page.

To ensure that the mdl-mini-footer remains at the bottom of your page even when there is not enough content (such as with dynamically generated content), it is recommended to place the footer inside a separate main element:

<body class="mdl-base">
   <div class="mdl-layout mdl-js-layout">
      <main class="mdl-layout__content">
         //Your content here
      </main>
      <main>
         <footer class="mdl-mini-footer footer">
            // Your footer here        
         </footer>
      </main>
   </div>
</body>

Answer №4

Using display: flex; on .mdl-mini-footer is causing issues. Removing it should fix the height problem.

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

Showing the computation outcome on the identical page

I have implemented a table within my PHP code. In the second column of this table, it typically displays "---". However, once I click the submit button, the same page should now display the calculated result. Here is an example: <table> <tr>& ...

Error: The specified module is missing an export that was requested

Hello, I encountered an error in my console that reads: "Uncaught SyntaxError: The requested module './components/tileHeader/controller.js' does not provide an export named 'tileHeader'". Below is the code snippet causing the issue: co ...

Tips for programmatically interacting with a Chrome extension's widget using Selenium or a different automation tool

Recently, I have been trying to find a solution to interact with an extension's widget using Selenium in C# without being limited by the HTML DOM. Unfortunately, my attempts so far, such as using the addExtension method or loading active extensions wi ...

Using Cascading Style Sheets (CSS) to make posts appear above an image in a scrolling format

Can anyone guide me on how to show the text above an image contained within a scroll bar, similar to the picture below? Despite trying position property and searching online, I haven't found a solution yet. Your help would be greatly appreciated. ...

When a DIV is clicked, trigger the fadein effect on another DIV; when the same DIV is clicked again, fade

I have a sliding panel on my webpage that reveals the navigation (www.helloarchie.blue). I want the content inside the panel to fade in slowly when it slides out, and then fade out when the user clicks the icon to close the panel. How can I achieve this ef ...

Adding an image to a server through PHP in the TinyMCE editor

Currently, I am in the process of utilizing TinyMCE text editor for uploading images using PHP and JS database. However, I find myself perplexed when it comes to sending the image to the server. Below is the snippet of the JS code being used: <script ...

Issue with triggering (keyup.enter) in Angular 8 for readonly HTML input elements

My goal is to execute a function when the user presses Enter. By setting this input as readonly, my intention is to prevent the user from changing the value once it has been entered. The value will be populated from a popup triggered by the click attribut ...

Presentation - hyperlink only functioning for final slide

I have a question about Lean Slider, which you can check out at My goal is to link each slide to a different URL. However, I'm facing an issue where only the code in the last slide seems to be executed and applied to all other slides. For example, if ...

What is the best way to include an active item within an li tag inside a div container?

Here is the structure for a widget that I have, and I want to add the active class to the li. I've tried doing this but it's not working and I'm unsure where the issue lies. var selector = '#recent-posts-5'; var url = window. ...

Ways to clear all CSS rules from a class without deleting the class itself using jQuery

Clear out all CSS properties within a class without actually removing the class itself using jQuery For instance : .ui-widget { font-family: Verdana, Arial, sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; left: 350 ...

Implement custom styles to enhance the appearance of users' Magento websites

Is it possible to add additional CSS only to users/customers who are logged into our webshop? If so, how should I go about it - through XML or PHTML? Stian ...

Tips for structuring a news thread with a staggered approach

On my Drupal 8 website, I have set up a newsfeed. How can I display the news items in staggered rows? I would like the first item to align on the left and the second item to be on the right, repeating this pattern for all subsequent items. Currently, I am ...

Update the text label to contain an input checkbox element within

I encountered this snippet of HTML in my form: <label class="ideal-radiocheck-label" onclick=""> <input id="pagamento_8" class="_input " type="checkbox" onclick="half(this,value);" checked="" value="980" name="pagamento[]" style="position: ab ...

How can I efficiently make a dropdown menu with search functionality instead of using datalist?

I am currently working on creating a custom searchable input field that makes backend calls. Instead of using datalist, I want to design a unique UI with ul and li items. While I have successfully implemented the search functionality, I am facing a glitc ...

What could be the reason for the Bootstrap 3 row not expanding to accommodate the content?

I am working with the following HTML structure: <div class="container-fluid"> <div class="row"> <div class="col-sm-push-3 col-sm-6 text-center wrapper"> <div class="col-sm-4 inner-wrapper"> & ...

The issue with setting width using % in React Native is causing trouble

While working on my project using expo react native, I encountered an issue with a horizontal scrollview for images. When I style the images using pixels like this: <Image code... style={{width: 350}}/>, everything works fine. However, if I try to ch ...

Choose the initial drop-down option and concentrate on it

How can I target the first drop down node (select element)? I have tried using this code to focus on the first input, but I am looking for a way to target the first select (drop down). $('.modal :input:first').focus(); Unfortunately, this meth ...

How to effortlessly bring modal windows onto the page from either side

I'm looking to have two hidden modal windows that can slide in from the left and right edges of the page. In my current setup, the left modal slides in from the right instead of sliding out from the left margin as desired. You can view the issue in th ...

Designing stylesheets for larger screens to optimize the layout

I am currently working on the front-end design of a website and could use some assistance regarding element sizing. While the layout and elements look great on my 19-inch, 1440x900 resolution monitor, I noticed that everything appears tiny when viewed on a ...

[php][html] stuck on trying to solve this error

Any help in figuring out the error on line 37 would be greatly appreciated. I've tried moving the ""; after echo and putting the entire PHP code in an img class="profilePic" src="http://i.imgur.com/ZICYW5z.png"/> and then using echo for the name (I ...