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: https://i.sstatic.net/Vm55V.png

In Firefox, the result is not as expected: https://i.sstatic.net/2njq9.png

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

Achieving Perfect Alignment for Absolutely Positioned Divs in

I'm currently facing an issue where the image I'm trying to center horizontally also moves the parent div downward when I try to vertically center it using top-margin. This is not the desired outcome. If you'd like to see what I mean, I&apo ...

Is it possible for a website to instruct a user's browser to save the entire page locally?

Is it possible for a (single-page) website to instruct a user's browser to save the entire page locally? To provide some background: I am running a website on a server that bills based on bandwidth usage. Since the content of the site remains mostly ...

Customizing the appearance of a local image with inline CSS using the style attribute and background-image:url

I'm having trouble loading the image Hormiga.jpg as a background for my slideshow using inline style. The url attribute doesn't seem to be applied correctly. Here is the original code where an image is loaded successfully: <div class="pa ...

What could be the reason for the hover attribute not functioning properly in NextJS

Why isn't my CSS recognizing the hover attribute? Here is my code: I would like the class "mega" to appear when hovering over the li tag. <nav className="mobile-hide"> <ul className="flex-item second-links&quo ...

What is the best way to showcase every user on my webpage using HTML?

After running this code snippet in my python terminal, I was able to see the desired output: views.py from django.contrib.auth.models import User userList = User.objects.all() print(userList) The above code produces the following result in the terminal: ...

Tips for retaining form inputs without the need for a submit event when the page is reloaded or refreshed

I have a form on a page with multiple text inputs In addition to the form, I have implemented Zend pagination to allow users to select results. However, when using Zend paginate, the user's form inputs are lost because it is not submitted. Since th ...

Insert a division into the table following every row

I'm working with a table that can be found here: https://codepen.io/anon/pen/bjvwOx Whenever I click on a row (for example, the 1st row 'NODE ID 1'), I want the div with the id #divTemplate to appear below that particular row, just like it d ...

Having trouble with the expand feature of Bootstrap 5 navbar

I am facing an issue with my Bootstrap 5 navbar as it only extends as wide as the contents within it. I want the navbar to expand the entire length of the container but changing the navbar-expand-?? setting doesn't seem to have any effect. https://i.s ...

Error occurred while attempting to update preferences in Firefox profile: The 'Options' object does not include the 'update_preferences' attribute

Having trouble updating my Firefox profile preferences. When I try to add options.update_preferences() it throws an error saying AttributeError: 'Options' object has no attribute 'update_preferences' Any ideas on how to fix this? P.S: ...

How can I convert the stylesheet link from fonts.google.com into a CSS class and include it in my file.css as an internal style instead of an external one?

Looking to incorporate a font from fonts.google.com? Here's how you can do it: <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300 ...

Adjust the table cell width to match the width of the ASP image

Below is the ASP image within a table cell: <tr> <td> <asp:Image runat="server" Width="64px" Height="64px" ImageUrl="~/Images/user64.png" /> </td> ...

Embed a website in an iframe and modify a portion of the URL within the embedded page

Welcome to my first question here! I am looking for a solution that will allow me to load a webpage inside an iframe while modifying parts of the URLs in any links on the page with different text. For example, let's say we load a website like "myweb ...

Using jQuery, retrieve the "select" element within a specific row of a

I am working on a table row that has the following HTML structure: When the user interacts with the "Name" field, I trigger the "select" event and pass it to the nameDropChanged function. Once I have a reference to this select element, I need to change th ...

The button must be programmed to remove a specific item from the server

I am currently developing an application to monitor my expenses using javascript, nodejs, express, and handlebars as the templating engine. Within the app, I have a "list" div that displays all of my expenses. (There is an add button next to the list, not ...

Can someone please show me how to position this H1 in the center at the bottom of the div?

Looking for a simple solution to place text at the bottom of a div without turning the entire div into a grid. New to HTML/CSS and struggling with vertical alignment issues... <!DOCTYPE html> <html> <head> <title>Creating an O ...

"Exploring the Power of Perl in Harnessing Html5 Server-S

I have been working on implementing server sent events to replace ajax long polling within my application. However, I have encountered an issue with my perl script where the sleep function is causing the sending stream to be blocked. #!/opt/lampp/bin/perl ...

Utilizing the map function in React to create a button reference

I am currently facing an issue that is relatively simplistic and doesn't have any real-world application. My goal is to locate a 'green' button and make it blink for a duration of 3 seconds. How can I achieve this using React? const btnLay ...

Properly spaced website images

I'm trying to display my images side by side with a slight margin in between them. However, when I apply a `margin-right: 10px;` to each div, the last image doesn't line up properly with my title bar. Is there a way to create spacing between the ...

Transformation of looks post a refresh

Initially, the CSS and appearance of the page look fine when I first open it (after clearing the cache). However, upon refreshing the page, a part of it changes (specifically, the padding direction of a div). This change occurs consistently with each refre ...

The function driver.find_element is unable to locate an element using the "class_name" attribute

My attempt at using driver.find_element, with the "class_name" method to locate and click on a button for expanding rooms on this website resulted in an error message: raise exception_class(message, screen, stacktrace) selenium.common.exceptions.N ...