``There are discrepancies in the rendering of the img and button tags between Firefox and Safari

I've encountered a challenging issue that I'm struggling to resolve independently.

Upon further investigation, the real problem lies in the varying rendering of the button tag in different browsers. Specifically, Firefox and Safari display the button differently compared to Chrome.

You can view the issue in action on this jsfiddle.

In Chrome, the image is distributed evenly without any white space left in the element (outlined in red). However, Safari adds some left-side spacing, while Firefox introduces both left-side and top spacing.

How can I target the button tag specifically for Safari and Firefox to address this problem?

CSS

.vlp_s_container {
    position: relative;
    /* height: 132px; */
    border: 1px solid red; 
/*  background-color: yellow; */
    width:206px;
}
/* Zoom In #1 */
.vlp_s_hover01 .vlp_s_fig .vlp_s_img {
/*  padding: 0px; */
    -webkit-transform: scale(1);
    transform: scale(1);
    -webkit-transition: .3s ease-in-out;
    transition: .3s ease-in-out;
}

.vlp_s_hover01 .vlp_s_fig:hover .vlp_s_img {
    -webkit-transform: scale(1.2);
    transform: scale(1.2);
}

.vlp_s_button {
    padding: 0px;
    margin-top: 0px;
    line-height: normal;
    display: block;
    border: none;
    text-decoration: none;
}

.vlp_s_button:hover {
    cursor: pointer;
}
.vlp_s_img {
    width: 206px;
    height: 116px;
    padding:0px;
    margin:0px;

}

.vlp_s_fig {
    width: 206px;
    height: 116px;
    margin: 0;
    padding: 0;
    background: #fff;
    overflow: hidden;
}

HTML

<div class="vlp_s_container" title="Watch This"
            id="abc">
            <div class="vlp_s_hover01 vlp_s_column">
                <figure class="vlp_s_fig">

                    <div>
                        <button class="vlp_s_button">
                            <img class="vlp_s_img"
                                src="https://upload.wikimedia.org/wikipedia/commons/7/76/Jenson_Button_2014_Singapore_FP2.jpg">
                        </button>
                    </div>

                </figure>
            </div>
        </div>

Answer №1

After conducting some research, I discovered that Firefox has specific padding and margins associated with the <button> tag. To resolve this issue in Firefox, you can utilize the following CSS code:

CSS

button::-moz-focus-inner { 
    border: 0; 
    padding: 0; 
}

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

Issue with "repeat-x" causing distortion in mobile image display

My repeating background image (.png) looks great on desktop with repeat-x, but on mobile, it has a slight repeat-y edge at the top: https://i.sstatic.net/yFfea.jpg The source image is 300px wide and 100px high, and the CSS for this div is: background: u ...

What is the best way to create this design with solely CSS, HTML, and Bootstrap (complete with check icon)?

I am eager to create this specific layout using only CSS, HTML, and Bootstrap. https://i.sstatic.net/ceyIv.png The green circle should contain a check mark symbol (although I couldn't manage to draw it in Paint). Pay attention to the text inside the ...

The navigation bar and text subtly shift when displayed on various devices or when the window size is adjusted

Hello, I am brand new to web development and have encountered an issue on my website. Whenever the window is resized or viewed on a different screen, the navigation bar (which consists of rectangles and triangles) and text elements start moving around and ...

Displaying two images side by side in HTML using Bootstrap

As a beginner in HTML, I am faced with the challenge of placing two images of different sizes side by side on the same row using HTML and Bootstrap. Below is my current code: <div class="row"> <div class="col-lg-6 col-md-6 col-xs-6 col-sm-6"> ...

Avoid a column from expanding according to its content by utilizing the grid-template property

Exploring the world of Css Grid, I'm delving into creating a unique layout with the grid-template Property: main{ width: 1444px; height: 70vh; display: grid; grid-template: 'cas cas cast' 'cas cas cast' ...

Google Map in Bootstrap FullScreen Mode Not Mobile-Friendly

Could you please take a look at the provided link and advise me on why the map is not responding correctly? I am also facing issues with the positioning of the map on the page, so any guidance on adjusting it appropriately would be greatly appreciated. Be ...

eliminate a specific portion of a string of text

I want to extract a specific value from a sentence by removing certain words. The desired value should be stored in a variable named thingLoved. For example, if the input is "I love cats", then console.log(thingLoved) should output "cats". The challenge l ...

Creating personalized HTML logs

My automated test script is set up in a way that automatically generates an HTML log file upon completion. You can find instructions on how to do this here. Is there a possibility to customize this HTML log or create my own HTML logger to replace the defa ...

Why does the hashtag keep popping up every time I launch the Bootstrap Modal?

I can't figure out why this keeps happening. I researched how to eliminate hashtags from the URL and found multiple solutions. However, none of them proved to be helpful as they only removed the hashtag, requiring a page refresh which still didn' ...

Struggling to make the jQuery timepicker plugin work on my JSP page

Hi everyone, I'm having trouble getting a jQuery plugin called timepicker to work. I already have a datepicker setup and running smoothly. I've spent hours researching this issue and trying different plugins. Here's my process: I download th ...

Modify the font style of numbers based on the keyboard language selected by the user

Is it possible to change the font family of numbers in input fields based on the user's keyboard language? For example, if the user is typing in Persian, the numbers should be displayed in a Persian font, and when they switch to an English keyboard, t ...

How to Modify the Top Position of an Element using uBlock Origin

In my efforts to reposition the main text of this website (), I am looking to move it from the middle to the top. The code for the section is <div id="content_blaettern_12793">. The current CSS styling has it fixed in place: #content_blaet ...

Display Information in Tooltip Using Text from a Different Source

I'm seeking a way to create tooltips on a webpage that provide definitions for specific words. However, these definitions are located on a separate page within the same website. Is it possible for me to extract the text I need to display in the toolti ...

Button group malfunctions on smaller screens

After integrating a button group into my new website, I noticed that the first two buttons stop functioning properly on smaller screens. Surprisingly, if I remove the text-center div, all buttons cease to work entirely. Despite attempting various solution ...

What is the best way to stop the max-height transition from automatically scrolling to the top of the page?

Initially, I have a div with a max-height of 0 to hide it. When an anchor is clicked, the div's max height changes to 800px, revealing its content. However, every time this transition happens, the page automatically scrolls to the top instead of maint ...

Utilizing CSS percentage height when the parent element is constrained by a defined minimum and

It is a common rule that when applying a percentage height to an element, the percentage is calculated based on its parent's height. Consider a scenario where you want a child element to be 40% of its parent's height. The parent element has both ...

"Ascend beyond the constraints of fixed measurements with dynamic

My JQuery image fader has a width of 100% and height set to auto. I'm thrilled that it works perfectly on the iPhone as well. Now, I am facing a challenge while trying to make content "float" after my JQuery slider. The problem arises because I use ...

Clickable tab to collapse a section containing an image and aligned text

When using Bootstrap 3, I have a button that collapses a div containing an image and text. The button alternates between showing a '+ More' and a '- Less' message. However, the alignment of the image is off with the text. Is there a way ...

Manipulating attributes in HTML using jQuery which are stored in a variable

Generating dynamic inputs with unique names is my current requirement. Initially, I store the html template content in a variable: var template = $("#question_template").html(); Next, to differentiate each set of added input blocks, I include an index: ...

Tips for creating a unified user interface framework for various web applications sharing a consistent design

Struggling to create a user interface framework for multiple web applications, I'm faced with the challenge of setting up the infrastructure in our unique situation: We have 7 (or more) different web applications built using asp.net mvc Some of thes ...