What is the connection between border radius and box shadow?

Take a look at this CSS code snippet:

div {
  background: rgba(0,0,0,.05);
  width: 200px;
  height: 200px;
  padding: 50px;
}

div > div {
  background: rgba(0,0,0,.2);
  width: 200px;
  height: 200px;
  border-radius: 5px;
  padding: 0;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .2), 0 2px 2px rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12);
}

div > div:hover {
  border-radius: 5px 5px 0 0;
  background: rgba(0,0,255,.2)
}

This is how it looks in HAML:

%div
  %div

When you hover over the inner element, not only does the border radius change but also the background color and box shadow. This unexpected behavior seems to be happening only in Google Chrome, not in Firefox, IE or Edge. I'm using Chrome version 71.0.3578.98 on Windows 10.

EDIT

Notice the incorrect behavior in Chrome:

https://i.sstatic.net/otUFT.png https://i.sstatic.net/YSeuN.png

You can see that the shadow changes suddenly when hovering over the element.

EDIT 2

Here's the correct behavior in Firefox 64.0:

https://i.sstatic.net/fdCFC.png https://i.sstatic.net/tU2DW.png

Answer №1

It seems like there was a technical glitch in Chrome version 71 that has been fixed in the latest release, Chrome 72.

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

Facebook fails to extract metadata from blog posts

Recently, I've encountered an issue with my blog posts not pulling up the metadata when shared on Facebook. Surprisingly, this problem only started happening from November 12 onwards. Strangely, all my previous posts before that date seem to be workin ...

Floating left and right positions for a fixed CSS div

My navbar is currently set to float right and 330px left with absolute positioning. Everything is working fine in this setup, but I want it to be fixed. The problem arises when trying to convert it to a fixed position. I've tried various methods but n ...

What could be causing my Google Chrome extension to only allow me to open 25 tabs instead of more?

Having a frustrating issue with my code that is causing problems when used as a Chrome Extension. Despite checking and confirming that the code should work correctly, it seems to stop opening pages after tab 25. I have verified that the code attempts to o ...

Display an Asterisk Icon for md-input fields with lengthy labels

Documentation states that md-inputs add an asterisk to the label if it is a required type. However, when input containers have width constraints and long labels, the label gets truncated and the asterisk becomes invisible. From a user experience perspectiv ...

Exploring the World of Html

I'm struggling with an HTML problem related to a web programming class I'm taking. The assignment involves creating a video game using HTML and JavaScript, where an image moves randomly on the screen and the player must click on it as many times ...

Is it possible to have a linear gradient with one color being completely see-through?

I'm looking to create a unique footer design similar to the one featured on . Instead of using a solid color for the left section, I want to incorporate an image as the background. Is there a CSS technique to stack backgrounds, with an image as the ...

`Modifying CSS in Bootstrap 4 for a personalized website design`

I am currently building a Bootstrap website for my sister, but I am facing issues with changing the CSS. Most of the time, the changes do not seem to take effect. I created a new file called "style.css" to override the Bootstrap styles and placed it below ...

What is the best way to use CSS to ensure that dynamic, data-driven characters can be properly displayed within a div

I'm in the process of updating a data-centric website that relies on information from an automated database engine. In the HTML, there's a fixed-size button containing text pulled from the database. I'm looking to incorporate some CSS styles ...

Is this JavaScript function acceptable?

My dilemma involves a carousel (specifically Owl Carousel) with controls that need to be vertically centered. Due to the structure, I have had to absolutely position the previous and next arrow indicators. Given the responsive nature of the page, their pos ...

Trouble with aligning action buttons in rows or columns with CSS

I am working with an HTML table that has dynamically created rows and columns using AngularJS. I want to add an option where users can hover over a row or column and see a delete button icon that, when clicked, will remove that row or column. While this fu ...

I don't want my background image to repeat, but I'm not sure how to stretch out the tile

Hey there, I would appreciate it if you could refrain from criticizing me or giving me negative feedback as I have put in the effort to search for an answer. After extensive research, this is what I have found so far. My goal is to set a background image f ...

The paragraph fails to trigger the CSS :hover effect when I assign it an ID

Here is an example of a CSS3 transition with ease effect: HTML <div class="button"> <a href="#" onMouseOver="clicksound.playclip()"></a> <p id="myId" class="top"></p> </div> CSS * { pad ...

Include an extra hyperlink in the adaptive menu bar

I have successfully created a responsive Navigation bar. Now, I would like to add an "Account" link on the right side of the navigation. My initial thought was to insert a div into a ul element, but I realize that this may not be W3C compliant. <div c ...

Using @font-face with Rails version 2.3.8

Hello, I am having trouble including a custom font in my Rails application. I am currently using Rails 2.3.8. I have placed my font folder in the public folder and below is my CSS code. However, it seems to not be working. Can anyone provide some assistan ...

Is there a way to dynamically change the title of a tab when new content is added to a minimized page?

Is anyone familiar with how websites like Facebook and Buzzfeed update their tab titles when there are multiple tabs open? I have noticed that sometimes they add a "(1)" or "(2)" to indicate changes on the page. Do they use JavaScript to achieve this eff ...

How come the dropdown menu consistently disrupts my CSS design?

Whenever I add a dropdown menu, my CSS layout gets all messed up. Can someone please explain why this happens and how to fix it? Below is the code snippet: <asp:Label ID="projnamelbl" runat="server" CssClass="editlabels" Text="Project Name"></as ...

Can the Bootstrap grid be arranged vertically?

I'm finding it difficult to work on a project with Bootstrap's horizontal grid system. What I want to achieve is to have my page divided into 4 sections, with the left side blocks having equal height and the right side blocks having varying heigh ...

How to dynamically set a background image using Ionic's ngStyle

I've been trying to set a background image on my card using ngStyle Take a look at my code below: <ion-slides slidesPerView="1" centeredSlides (ionSlideWillChange)= "slideChange($event)" [ngStyle]= "{'background-image': 'ur ...

Top pick on bootstrap 5 navigation pane

Hey everyone, I'm currently working on setting up a featured post within a Bootstrap nav-pill that includes categories. The goal is to display 5 contents from the selected category in two separate divs and designate the first article as the featured o ...

From Table to DIV: A Simple Conversion

I have encountered a major issue that has stumped me so far. Perhaps you can assist me. I am dealing with a table that appears as follows: __________________________________ | | time1 | time2 | time3 | +--------+-------+-------+-------+ | John | ...