Are box shadows displaying different hues across various web browsers?

Yesterday, I came across a minor issue with my website. The Box-Shadows appear differently on various browsers. Previously, it was red on Firefox and IE, but now it looks completely different on:

  • Opera: Orange
  • Chrome: Violet
  • Safari: Blue

Why is that happening?

Here is my CSS code:

input.test {
  ...
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
  -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
  ...
}

input.test:focus {
  ...
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(159, 48, 57, 0.6);
  -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(159, 48, 57, 0.6);
  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(159, 48, 57, 0.6);
  ...
}

Could the issue be related to the transition I am using? Or is this a common occurrence?

Here is the transition CSS:

input.test {
  ...
  -webkit-transition: border-color 0.75s ease-in-out, box-shadow 0.75s ease-in-out, color 0.75s ease-in-out, background 0.75s ease-in-out;
  -moz-transition: border-color 0.75s ease-in-out, box-shadow 0.75s ease-in-out, color 0.75s ease-in-out, background 0.75s ease-in-out;
  -o-transition: border-color 0.75s ease-in-out, box-shadow 0.75s ease-in-out, color 0.75s ease-in-out, background 0.75s ease-in-out;
  transition: border-color 0.75s ease-in-out, box-shadow 0.75s ease-in-out, color 0.75s ease-in-out, background 0.75s ease-in-out;
  ...
}

I hope someone can assist me in resolving this issue. I really want my box-shadow to appear in the same color across all browsers.

Answer №1

After some investigation, I discovered that certain browsers such as Opera, Chrome, and Safari automatically add outlines to form elements when they are focused. This can affect the appearance of box shadows, especially when opacity is used.

To solve this issue, simply add the following CSS:

input:focus, textarea:focus {
  outline: 0 none;
}

A similar problem was discussed here: how to remove textbox outline in Opera

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

The Elusive Key to Perfect Layouts and its Transformation

Today I discovered the Holy Grail of Layouts while coding, but when I implemented it, the output in browsers was not as expected. The borders were incomplete and strange: Here is the code snippet that caused the issue: #container { border: 10px soli ...

issue occurring when customizing bootstrap in django

For the past couple of hours, I've been grappling with a puzzling issue while attempting to override Bootstrap in Django. Initially, without any custom CSS files, the outcome looked like this: https://i.sstatic.net/GLndf.png Subsequently, I crafted ...

mobile-friendly sticky footer

Currently working on a website project utilizing Bootstrap 3 (http://www.patrickmanser.ch/fnws) and I am trying to implement a sticky footer. After adapting the code snippets from Bootstrap 3 examples according to my specifications, everything seems to fun ...

Nested div elements maintain background-image continuity

Is it possible to maintain the background image of the body within a child div that has a red background color with opacity? * { box-sizing: border-box; } body { background-image: url('https://d6scj24zvfbbo.cloudfront.net/306f4bc782c04bbe4939f8c ...

Create a button toggle feature to dynamically display data for a specific record within an ng-repeat loop

Currently, I am facing an issue while implementing a start and stop timer in JavaScript for a list of records. To display all the items, I am using ng-repeat. Each repeated element has a Start/Stop toggle button. The problem arises when there are 4 records ...

How to position an image on top of each printed page using HTML/CSS (SCSS)

I've created a simple and small webpage that looks like this: https://i.sstatic.net/R7Ajz.png Everything is perfect in the browser, with all the styles (margin, padding, etc.) just as I want it. However, my issue lies in the print view of the page. ...

What is causing the col-auto with the red border to exceed its available height?

For this code, I've utilized version 5 of Bootstrap. In full screen width, the col-auto with the red border seems to be taking up more space than its content. The yellow border marks the available content space inside. I'm curious about what migh ...

How do I hide a div if its contents exceed the available space in CSS?

On mobile screens, one of my divs is displaying below the navigation bar and I want to hide it using pure CSS. Can anyone suggest a solution? I've attempted using "text-overflow: hidden;" and "overflow: hidden;" but they don't seem to be working ...

Can one image impact other images through a wrapping function?

I am facing an issue with positioning 3 images independently from the window size using the position: relative declaration. When I try to define positions for the first 2 images and then insert the third one, it disrupts the position of the first two. Is ...

Issue with Internet Explorer's CSS

It appears that this page is not displaying correctly in Internet Explorer 9, along with possibly older versions as well. The issue seems to be with the right menu floating to the bottom of the page. Firefox, Chrome, and Safari are all rendering it correct ...

Ensure that the input group is entirely visible and does not wrap within a table cell

I am facing an issue with an input group placed in a table cell where the button wraps below a certain size. I want to prevent this behavior specifically for this table cell and the rest of the column. The relevant html generated with added javascript elem ...

Tips for inverting the z-index order of stacked divs

On my webpage, I have set up multiple columns enclosed in divs like this: <div class="first column" style="width:33%; float: left;"></div> <div class="column" style="width:33%; float: left;"></div> <div class="last column" style ...

Is there a way to locate ComputedStyle elements using Nokogiri?

I am currently using Ruby along with Nokogiri to parse through HTML documents. I am looking to select all nodes that match a CSS class with the style attribute display: none, but the CSS class is unknown in advance. For example: <html> <body&g ...

Utilizing rvest to extract user videos from Twitter

When using rvest to extract data from websites, I found that I am unable to scrape dynamic content. For instance, how can I extract the audience count (44K) from this video post? https://i.sstatic.net/CRXZ9.png Here's what I attempted: library(rves ...

The box-shadow feature in Bootstrap 5 is causing overlap issues within the input-group

I am attempting to customize the css for my input-group and input-group text when the input is in focus. I am working with bootstrap 5 at the moment. However, there seems to be some overlap between the input and input-group-text as shown in the image belo ...

Arrange two internal divs on top of one another with the option to maintain the float

While searching for a solution to my issue, I noticed that most responses involved removing the float property. However, since I am new to CSS, I would like to explore using float and see if it's the best approach. Here is the fiddle I've been w ...

Custom-fitting column widths in Bootstrap 5

Trying to achieve an autofit for the second column width using the code provided (view code here), but the use of auto margins doesn't seem to be effective. .col { border: 1px solid red; } .autofit { margin: auto; width: auto; max-width: ...

When all y values are zero, Highcharts.js will shift the line to the bottom of the chart

Is there a way to move the 0 line on the y axis to the bottom of the chart when all values are 0? I attempted the solution provided in this post without success. Highcharts: Ensure y-Axis 0 value is at chart bottom http://jsfiddle.net/tZayD/58/ $(functi ...

Looking for assistance with CSS | Implementing hover image with zoom effect

Currently, I have a page created using DIVI WordPress: My issue arises when attempting to implement a zoom effect on images upon hovering, as the image exceeds its designated div area. I attempted to utilize CSS code from this source: https://codepen.io/ ...

Is the navigation bar offset causing an issue?

After struggling with my navigation menu in Google Chrome, I finally found a solution. However, the nav bar is now offset on one page but not on another. For the aligned main site view, visit , and for the left-offset forum view, visit . This is the HTML ...