In Firefox 50.0, the button's resizing feature causes the parent div container outline to adjust size

I am currently working on developing a responsive design with the feature of having a button that appears to "float" under a div element.

My desired outcome is achieved in Opera and Chrome:

In Firefox, the result is not as expected:

You can access my complete code here: https://jsfiddle.net/fej93gg5/

How can I resolve this issue?

Edit: After discovering a bug report for Firefox here, it seems like this bug has been around for a long time and may not be fixed any time soon. Hence, I am now searching for a workaround.

<div class="blockcontainer-2col with-outline vertical-center ">
    <div class="blockcontainer-content">

    <h2 class="titlecontent-2col">Some title</h2>

    <div class="textcontent">
        <ul class="bulletlist">
            <li>Blah blah</li>
            <li>Blub blub</li>
            <li>Whoopdi doopdi hokus pokus kdkjeljer</li>i>
        </ul>
        <!-- This button is not supposed to resize the outline -->
        <div style="display: float; font-size: 1.7em; text-align: center; font-weight: bold;">
             <a class="flatblockbutton" href="http://bluedomainer.com/portfolio/">Check out portfolio</a>
        </div>
    </div>
    </div>
</div>

This is the full css:

/* reset all margins and borders to zero */
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video {
margin:0;
padding:0;
border:0;
font:inherit;
vertical-align:baseline
}

...
... (Remaining content unchanged for brevity)
...
.flatblockbutton:hover, .flatblockbutton:focus {
    background: rgba(16, 145, 202, 1);
    text-shadow: -1px 1px 10px #ffc, 1px -1px 8px #ffffff;
    box-shadow: 5px 7px 12px 10px rgba(0,0,0,0.14);
    top: 1.5rem;
    left: -0.5rem
}

Answer №1

This issue stems from a long-standing problem in Firefox tagged as Bug #687311

I discovered that there was no need to persist with using outline. Instead, I replaced it with border, offering a more practical workaround when outline is not mandatory.

In essence, rather than:

/* make white transparent outline - buggy in Firefox*/
.with-outline {
outline: thick solid;
outline-color: rgba(255, 255, 255, .5);
outline-width: 1rem;
background-color: white;
}

I opted for:

/* make white transparent border - works in Firefox*/
.with-outline {
border: 1rem solid rgba(255, 255 ,255, .5);
background-color: rgba(255, 255, 255, 1);

-moz-background-clip: padding;     /* Firefox 3.6 */
-webkit-background-clip: padding;  /* Safari 4? Chrome 6? */
background-clip: padding-box;      /* Firefox 4, Safari 5, Opera 10, IE 9 */
}

You might also consider renaming your class from with-outline to with-border. The use of background-clip is crucial to prevent the background color from overlapping with the border.

Check out the solution here on jsFiddle

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

What could be causing my Codepen code to malfunction?

I've transferred the code from CodePen to Atom and saved it. Even though I have added the jQuery script and linked the stylesheets correctly, my local page is still displaying differently. Codepen - http://codepen.io/jordan_miguel/pen/gLwJRb Browser ...

Can someone help with the issue where the CSS field position changes when the "X" icon appears, as mentioned in the title? I am looking for a solution to fix this problem

When trying to add an additional field on a page, the "X" icon appears inline with the field and causes the other fields to adjust their position. However, I want the new field to remain in the same position as the title. How can I achieve this while keepi ...

Choosing the Right Alignment for Your Selection Box

How can I adjust the alignment of the select box to make it inline with the others? I also need to apply this alignment to the three option input boxes. CSS: #newwebsiteSection, #websiteredevelopmentSection, #otherSection{ display:none; } #newwebsite ...

Uploading custom images with a WordPress widget

I have been occupied with developing my own WordPress Widget, and almost everything is functioning smoothly except for the WordPress media uploader. I have incorporated eight buttons and input text fields to store the URL of the uploaded image. The click ...

Adding multiple text as label and sublabel in a React MUI Tooltip can be achieved by utilizing the appropriate

I'm struggling to incorporate a MaterialUI Tooltip into my React application with two separate text lines. The first line should serve as the main title, while the second line functions as a sublabel. In this screenshot provided, you can see where I ...

Creating Header Images for Websites, like the way Facebook does

Exploring how to properly configure the header image on my website has been intriguing. The main issue is that when I view it on my laptop, which has a width resolution of around 1280px, the header image's width measures about 2000px. My goal is to h ...

Assist me in temporarily altering the color of menu items in a sequential manner upon the page's loading

Currently, I'm working on a website that features a subtle dark grey menu at the top of every page. The menu is built using HTML and CSS with a list structure. To highlight the corresponding menu item based on the current page, I am utilizing the ID a ...

Executing the main process function

One of the challenges I'm facing is calling a function from the main process in Javascript while a button is clicked in another file. Here is the code snippet: Main.js const electron = require( 'electron') const {app, BrowserWindow} = elec ...

Learn how to create a logarithmic scale graph using CanvasJS by fetching data from an AJAX call

window.onload = function() { var dataPoints = []; // fetching the json data from api via AJAX call. var X = []; var Y = []; var data = []; function loadJSON(callback) { var xobj = new XMLHttpRequest(); xobj.overrideMimeType("applicatio ...

How to dynamically change the position of an input field within a form using JavaScript and jQuery

I have a form displayed on my website that looks like this: input a input b input c I am wondering if it is achievable to rearrange the order of inputs using jQuery, like so: input a input c input b However, it is important that the data is still ...

My attempt to establish a connection to the browser using Selenium testing has encountered failure

I am struggling to build a web browser in my Python Selenium test. The error message indicates that the versions of Firefox and Geckodriver are not compatible, even though both are up to date. Has anyone else faced this issue before and found a solution? ...

Shifting and implementing various styles across numerous elements at the same time

There is an anchor tag containing two spans... <a class="banner-logo" href="/search"><span id="banner-logo-hello">Hello</span><span id="banner-logo-world">World</span></a> When hovering over the anchor tag, I want to c ...

What is the best way to position a div in relation to a table header (th) but not inside it?

I'm trying to create a table header that displays a help text (div) when clicked on. However, the help div is causing the table header to be larger than the other headers. Below is the code snippet: #help_box { border-radius: 20px; ba ...

What is the best way to utilize $(target) within a directive?

I created a custom directive for selecting time using two blocks. The challenge is detecting the target event on specific blocks within the directive's template. Directive Template: <div class='time-picker-container'> <div clas ...

iTextSharp rendering HTML to PDF in a unique way compared to browsers

I'm currently working on converting an HTML invoice to a PDF within my application, but I'm running into issues where the resulting PDF appears different from how the page displays in various browsers like IE, Chrome, and Firefox. Does anyone ha ...

Creating an HTML table by populating it with data from a JavaScript array

Imagine you have a JavaScript array structured like this: [ "Heading 1", "Heading 2", "Data 1", "Data 2", "Data 3", "Data 4", ] Your task is to generate an HTML table from this array that looks like the one in this link: https://i.stack.imgur.com/7laUR. ...

How can I delete a hyperlink on a number from my iPhone or iPad?

Is there a way to prevent certain sets of numbers from being linked, like phone numbers do on iPhones? <h2>Table</h2> <table class="table table-sm table-striped table-hover"> <caption class="sr-only">Search Results</caption> ...

Strange Data List Phenomenon

Presented here are two distinct datalists, one containing patient filenumbers and the other containing states. <input type="list" class="form-control" name="patient" list="patient-list" placeholder="Enter Patient file number"> <datali ...

The requested resource at http://js:port/socket.io/1/ could not be located (Error 404

Having trouble connecting with Socket.io. This is the server-side code: function chatserver(){ var express = require('express'), app = express(), server = require('http').createServer(app).listen(app.get('port'),function ...

The video is not displaying on the webpage when connected locally, but it appears when the source is a URL

Recently, while practicing some basic tasks on a cloud IDE called Goorm, I encountered an issue with displaying a video on a simple webpage. The EJS file and the video were located in the same folder, but when I set the src attribute of the video tag to "m ...