Unwanted borders appearing on hover, active, and focus states in Firefox

To see an example of this issue, visit this link.

I am encountering a problem in Firefox where the button appears differently on hover, focus, and active states compared to the default state. I have searched through various resources like this and this, but have not been able to find a solution.

The issue is that when hovering or clicking on the button, Firefox either adds a border around the bottom of the button or shifts the box shadow by one pixel, creating an outline effect.

Below is the code snippet:

<a class="lm-button lm-button--primary">Primary Button</a>

.lm-button, .lm-button--primary, .lm-button--secondary {
  display: inline-block;
  padding: .7em 1.25em .4em;
  font-family: arial;
  line-height: 1em;
  text-align: center;
  border-radius: 8px;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: all 100ms ease-out, transform 75ms ease, background 300ms ease-out;
}
.lm-button:focus, .lm-button--primary:focus, .lm-button--secondary:focus, .lm-button:active, .lm-button--primary:active, .lm-button--secondary:active {
  transform: translateY(0) scale(0.95);
}

.lm-button {
  color: #fff;
  background: #57554f;
  border: 1px solid #57554f;
  border-bottom: 0 none;
  box-shadow: 0 0.2em 0 #2f2e2b;
  margin-right: .5em;
}
.lm-button:hover {
  color: #fff;
  background: #64625b;
  box-shadow: 0 0.25em 0.05em #2f2e2b;
  transform: translateY(0) scale(1.025);
}
.lm-button:focus, .lm-button:active {
  color: #fff;
  border: 1px solid #57554f;
  background: #4a4843;
  border-bottom: 1px solid #4a4843;
  box-shadow: 0 0.25em 0 #4a4843, 0 0.15em 0.15em #1c1c1a inset;
}

I am puzzled by this behavior and are seeking potential solutions.

Answer №1

I believe the problem lies in browser-based accessibility settings.

To address this, you can attempt the following:

selector::-moz-focus-inner {
  border: 0 !important;
}

selector:focus, selector:hover, selector:active {
   outline: 0 !important;
}

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

Ways to decrease the saturation of a background image within a div using CSS

I've come across many plugins that can desaturate an image within the tag. However, I haven't been able to find a solution for desaturating a background image that is used for an element (div). Is there a way to desaturate the background image ...

Is there a way to link two HTML files containing jQuery within an HTML index file?

I'm currently working on creating an index page for a pair of HTML files that utilize jquery. Let's break down the structure of these files: Emps1, Emps2: These are two HTML tables that start off empty. TabA_stats, TabB_stats: Each HTML file ha ...

I am attempting to dynamically align the images of two articles. The exact heights of the containers are not specified. Can anyone provide guidance on how to achieve this?

My code snippets: <article class="featured"> <img src="http://www.placehold.it/300x100/ff0000"> <p> <!--Text--> </p> </article> <article class="sub-featured"> <img src="http://www.placeh ...

The slider components have an endless loop feature that only runs once before coming to a

I'm working on creating an infinite slider that loops continuously without the need for navigation buttons. Instead, I plan to allow users to control the slider using touch gestures (although this functionality is not yet implemented in the code snipp ...

Grab onto a nested section

What is the solution for targeting the h2 span element? div#content div.view-content div.view-row-item h2 span { ... doesn't seem to be doing the trick... ...

What is the best way to ensure that my text is perfectly centered both horizontally and vertically within this DIV?

What's the best way to vertically and horizontally center text? Here is an example code that needs to be centered: <div style="display: block; height: 25px;"> <span id="ctl_txt" style="background-color: rgb(255, 0, 0);"> Basic ...

Execute a multitude of web addresses within a single Selenium IDE test

I am interested in automating the process of running a single test on multiple URLs using the Selenium IDE plugin for Firefox. In my load-balanced environment, I have identical websites hosted on several servers. For internal testing purposes, I can access ...

Having trouble uploading a document with the <input type="file"> feature on the Firefox browser

UPDATE: Issue with file upload I am facing a problem while trying to upload a file using Java webdriver. Despite setting up everything correctly, the file upload function does not seem to be working on Firefox. WebElement uploadFile = nav.getWebDriver().f ...

Can someone help me troubleshoot why my multi-step form is not functioning properly?

I've been working on a multi-phase form, but it's not behaving as expected. I've tried different code variations, but for some reason, it's not functioning properly. After spending two days on it, I'm starting to feel a bit frustra ...

Customizing CSS color to blend seamlessly with Bootstrap's theme

Currently, I am in the process of creating a new CSS class with a background color similar to the one used in Bootstrap's "bg-primary" class. Although I have looked through the documentation and learned that using the color as a variable in other CSS ...

Adjust the Bootstrap 4 HTML code to eliminate the rounded edges on the parallax jumbotron

I am currently working on a captivating parallax effect for my homepage, but I'm looking to eliminate the rounded corners from the images. Below is the HTML code for one section: <div class="jumbotron paral paralsec1"> <h1 class ...

The middle toggle line stubbornly refuses to properly disappear

I'm facing an issue with the toggle button on my practice site. When clicked, it undergoes a transition and displays a cross or X symbol. I've used CSS to create a cross shape by hiding the middle line. However, after the transition, the middle l ...

How to create a freeze panes feature like MS Excel using HTML and CSS

In my web application for iPad using Angular JS, HTML5, and CSS3, I'm facing a challenge with a large table that requires both horizontal and vertical scrolling, along with a "freeze-pane" feature similar to MS Excel. Currently, I've divided the ...

Distance from the border

Having a small issue with margin, here is the code: echo '<p class="news_post">'; $stripped = strip_tags($post,'<img>'); $break = str_replace('>','><br>',$stripped); ...

CSS for a Dropdown Menu with Multiple Layers

I've successfully implemented a dropdown menu, but now I'm facing the challenge of adding another level to it. Specifically, I want a second level to drop down when hovering over "Test3". What do I need to add or modify in the code to achieve thi ...

Align two containers centrally using absolute positioning inside a division

I am looking for a way to centrally align two "boxes" within a div using CSS. These boxes are positioned absolutely. For reference, here is the JSFiddle link: http://jsfiddle.net/p4sA3/8/ Is there a method to achieve this alignment without specifying spe ...

Tips for aligning objects within a grid container

Would you happen to know how I can perfectly center text and image together? Below is the code snippet I've been working on: <div class="container my-5"> <div class="row py-4 justify-content-center"> ...

What is the best way to use CSS to hyphenate a capitalized word?

I have a single word that needs to be hyphenated, but the lang=en hyphenate: auto property does not work on capitalized words. To address this, I utilized the slice function in JavaScript to split the word in half so that the second half, which requires h ...

Incorporate a CSS style element to a hyperlink button in JQuery Mobile

I am trying to apply a style to a link button element using JQuery. The code I have written is not working. Can anyone provide suggestions on how to achieve this? Below is the snippet of the HTML <div data-role="content"> <a href="#" class= ...

Stop Bootstrap form controls from displaying a focus glow when clicked

A virtual directory has been created where users have the ability to change file and directory names. Users can only edit names by double-clicking: <input type="text" class="form-control border-0 p-0 mb-1" ...