Why is there a blank white space under my image in Safari?

I am struggling to understand why Safari is adding a white space at the bottom of the image on my current website project.

Interestingly, Firefox and Chrome display it correctly. The image should stay fixed at the bottom of the page even when resized.

Here is some of the HTML code:

<!-- Page Content -->
<div class="container-fluid">


    <div class="span12">

        <div id="headImage">

            <img class="center fit" src="images/Dale2.png" onmousedown='return false;' ondragstart='return false;'>
        </div>

    </div>

    <!-- ./container -->


    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>

    <script src="http://code.jquery.com/jquery-latest.js"></script>

    <script type="text/javascript" language="JavaScript">
        function set_body_height() { // set body height = window height
            $('body').height($(window).height());
        }
        $(document).ready(function () {
            $(window).bind('resize', set_body_height);
            set_body_height();
        });


        $('img').bind('contextmenu', function (e) {
            return false;
        });


        $(document).ready(function () {
            $(".center").hover(function () {
                $(this).attr("src", "images/DaleBlurWithText.png");
            }, function () {
                $(this).attr("src", "images/Dale2.png");
            });
        });
    </script>

</body>

And here is the corresponding CSS:

body {
 max-height:100%;
 min-height: 100%;
 background-color: white;
 padding-top: 50px;
 overflow: hidden;
 -webkit-overflow-scrolling: touch;
}

.navbar {
 background: white;
 border: none;
}

.navbar-brand nav navbar-nav {
 text-align: center;
}

.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
margin: 0;
}

.navbar navbar-collapse {
text-align: center;
}

* {
padding: 0;
margin: 0;
}

.fit {
/* set relative picture size */

max-width: 100%;
max-height: 100%;
}

.center {
 display: block;
 margin: auto;
 bottom-fixed: 0;
 vertical-align: bottom;
}

Answer №1

Consider adjusting the display of your image to block level

Answer №2

To resolve the problem, I made a simple adjustment to my .center class in the CSS code:

.center {
    display: block;
    position:fixed;

    /* Center the image */
    right: 0;
    left: 0;

    margin-right: auto;
    margin-left: auto;
    bottom: 0;
    /* set relative picture size */ 
    max-width: 100%;
    max-height: 90%;

}  

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

Is it possible to consolidate a Next.js Application into a singular JavaScript file for seamless incorporation into an external HTML webpage?

Currently, I'm in the process of integrating a Next.js application into an existing HTML page. My goal is to display Next.js components on this HTML page by linking a JavaScript file (created from the Next.js application) within a <script tag. Howe ...

Encountering Uncaught Promise Rejection Warning in Node.js

I can't figure out why I am receiving this error or warning when my code appears to be correct. Below is a snippet of the UserModel that I have been working on: const fs = require('fs'); class UserModel { constructor(filename) { ...

Issue with Axios in my React Application: Unidentified SyntaxError

As I attempt to connect to my database using axios, a frustrating error appears in my vsCode terminal. The error message reads as follows: SyntaxError: C:\Users\Kelly Owoju\Desktop\Kelly Bright\my-web-app\node_modules\a ...

Utilizing jQuery to Determine Specific Functions for Each Page

In my current development setup using ASP.NET, I have a single jQuery script page that is included in the ScriptManager on the MasterPage. This script contains all of my custom functions for all pages of my website. While some prefer to split their scripts ...

Incapable of grasping the intricacies of condensed

I recently came across a code snippet on geekcode(dot)tk and I have a question about it. Specifically, I would like to understand why the section within the table data tag is written in that particular way (at the bottom of the provided code). Thank you fo ...

How can I collapse the dropdown menu in typeahead.js?

I am currently utilizing typeahead.js for a typeahead functionality. My goal is to achieve the opposite of what was discussed in this thread: Programmatically triggering typeahead.js result display Despite attempting to trigger a blur event on the typeah ...

Can the color of text be adjusted (to either white or black) based on the background color (in any color and format)?

To achieve a text color that contrasts well with any background, I need to make sure it's either black or white. The background in my app can vary in color and format, so finding the perfect solution has been challenging. Using mix-blend-mode doesn&a ...

What is the role of character encoding in Ajax and JQuery?

My web application (UTF-8) allows data to be sent to the server using the following characters: áéíóú àèìòù ÀÈÌÒÙ ÁÉÍÓÚ When sending data, I typically use the following method: // Utilizing $("#myForm").serialize() $.get("/path?", $( ...

The behavior of -webkit-border-radius differs from that of -moz-border-radius

My website is displaying differently on Safari compared to Firefox. I want the CSS to make it look consistent across both browsers. I understand that I could use two div boxes - one for the outline and one for the image. However, I prefer how Firefox only ...

retrieving information from server via ajax to display on chart

I am currently utilizing the jqPlot JavaScript library for generating graphs and charts in one of my applications, which can be found at . Within my application, there are approximately 5-6 pages where I have integrated this library. However, I would like ...

Why is React JS unable to discover my exported modules?

Upon running my React app, the console displayed the following error message: Failed to compile. ./src/components/login/index.js Attempted import error: 'Login' is not exported from './login'. Here is an overview of the folder struct ...

I am trying to figure out how to effectively utilize the $("body").scrollTop() function in jQuery

In relation to my previous question , I am looking to create an effect where as the user scrolls down the page, the opacity of the subsequent divs will increase to cover the main video. A working example can be found here: https://jsfiddle.net/Leytgm3L/38/ ...

Using VueJs to create custom Like and Unlike buttons with Vfor loop

How can I make the buttons increase separately? I've tried similar solutions, but they currently increase the number of likes and dislikes together at the same time. Additionally, I am receiving this message in the console: vue@next:1250 [Vue warn]: ...

Clicking on the icon will cause the table to expand

Is there a way to simply expand the line by clicking on the arrow icon (expand_more) instead of expanding the entire section? If you want to see code examples in Angular Material, check out this link: https://stackblitz.com/angular/oyybnyopyemm?file=app%2 ...

Updating the background SVG display in JavaScript/React according to the current state value

I am currently immersed in a project for my Bootcamp that involves creating a functional product with an aesthetically pleasing front end. I have chosen to utilize a .SVG as the background, set via CSS, and have successfully managed to alter the displayed ...

The jQuery AJAX call is successful in Firefox, but unfortunately, it is not working in Internet Explorer

I've encountered a perplexing issue with an AJAX call. It's functioning perfectly fine in Firefox, but for some reason, it's not working in IE. Curiously, when I include an alert() specifically for IE, I can see the returned content, but the ...

Tips for Making JQuery UI Droppable Work with Multiple Elements

I've been tasked with modifying a piece of code that currently allows users to drag one row from a table to a div. The new requirement is to enable users to select multiple rows and drag them all to the div. I'm struggling to tweak the existing c ...

Ways to update the CSS classes of a bootstrap navigation menu

I am working with a bootstrap navigation bar that includes an option called "Add New Candidate" as a list item. I need to update its class from "nav-item has-treeview" to "nav-item has-treeview menu-open" when the user selects it, and also change the class ...

Can you explain the functionality of icon maps (or charts)?

As I was exploring the source code of various websites, I noticed a common pattern - all the icons were stored in one image map. Upon further investigation, I discovered that each icon is referenced individually when needed. I came across a helpful article ...

Modifying Arrays with Different Data Structures in JavaScript

I am interested in implementing the following scenario: var A = ["Jon","Brad","Rachel"]; var B = ["Male","Male","Female"]; var C = [ {"Jon","Male"}, {"Brad","Male"}, {"Rachel","Female"} ] Can you guide me on how to retrieve var C using javascrip ...