What could be the reason for my background gradient overflowing beyond the border on Mac and iOS devices?

I am encountering an issue with my carousel of rounded images that have a gradient overlay. The problem is that sometimes the gradient doesn't follow the border-radius and extends beyond it in its default square shape, instead of conforming to the rounded edges. Surprisingly, I have not been able to replicate this problem on my own Mac, but one of my designers has reported experiencing this frequently on her Mac and iPhone:

https://i.sstatic.net/sYsKn.jpg

Below is the CSS code I am using for styling the image and gradient:

.carousel-image-container {
        position: relative;
        padding: 0px;
        border-radius: 50%;
        border: 6px solid white;
        cursor: pointer;
    }

    .carousel-image-container img {
        display: block;
        width: 100%;
        max-width: 100%;
        border: 0;
        margin: 0;
        padding: 0;
        border-radius: 50%;
    }

    .carousel-image-container::after {
        display: block;
        position: relative;
        background-image: linear-gradient(to bottom, rgba(69, 72, 77, 0.07) 5%, rgba(69, 72, 77, 0.1) 8%, rgba(0, 0, 0, 1) 100%);
        margin-top: -300px;
        height: 300px;
        width: 100%;
        content: '';
    }

Has anyone encountered a similar issue before? Any help or suggestions on how to resolve it would be greatly appreciated.

Answer №1

It appears that the border-radius is only being applied to the <img> element and not to the :after pseudo-element.

.carousel-image-container:after {
  border-radius: 50%;
}

Adding this code should resolve the issue. If it doesn't, please provide a [mcve] so that I can further investigate your setup.

Alternatively, you can try:

.carousel-image-container{
  overflow: hidden;
}

Answer №2

Don't forget to include border-radius in the .carousel-image-container::after selector, as shown below:

.carousel-image-container::after {
    border-radius: 50%;
}

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

Ionic directive ng-disabled not functioning as expected

Upon running the Ionic application, I noticed that the radio button is not being disabled even with the use of ng-hide.<input type="radio" ng-disabled="true"> ...

The navbar slide toggle is supposed to slide behind the navbar, but instead it slides in front of

Recently, I created an animated navbar that works perfectly fine. However, there is one issue that bothers me - when the list of menu items slides open, it appears in front of the navbar instead of behind it. If you'd like to see the problem in actio ...

Conceal a particular object from view by selecting it from the menu

I want to hide a specific element when the burger button is clicked. (See CaptureElementNoDisplay.PNG for the element to hide) When I click the burger button again to close the menu, I want the hidden item to be displayed once more. I've successfull ...

Troubleshooting issue with Django development server causing HTML5 video element to become non-seekable

My Django app is currently serving a webpage with an HTML5 video element, but I've encountered a strange issue. The video.seekable property is returning a timeRanges object with a length=0, when it should actually be length=1. Unfortunately, this mea ...

The art of expertly placing the arrow in <details> with CSS

I'm looking to adjust the placement of the arrow within details. I've experimented with using float:left, but when the line is too long, like in the example provided, the arrow shifts to the beginning of the line below when I resize the window. I ...

Using JQuery to dynamically set dropdown option values from a JSON object

I have an HTML code snippet: $.ajax({ type: "POST", url: "hanca/hanca_crud.php", dataType: 'json', data: { id_hanca: id_hanca, type: "detail_hanca" }, //detail_hanca success: function(data) { var teks = ""; $.each( ...

How can I adjust the size and width of the autofocus cursor inside an input box using Angular?

How can I modify the height and width of the cursor in an input field with auto focus? app.component.html <input class="subdisplay" [ngModel]="input | number" type="text" (keyup)="getValue(box.value)" name ...

Displaying data retrieved from PostgreSQL query

I'm currently developing a PHP data analysis tool that pulls data from our production server, which uses Postgres, and displays it. During the process, I run a select query in a loop where the date is passed as a variable, resulting in output like th ...

Issues with autoplay not functioning in Chrome browser with Youtube iframe source

I have added an iframe code to my simple HTML page. I would like the video to autoplay when the page loads. It works perfectly in Firefox, but in Chrome, the autoplay feature does not work. Here is my code: <iframe width="420" height="345" src="https:/ ...

Is there a way to use viewDidLoad() in a SwiftUI View?

I'm faced with the challenge of loading an image after the view has already loaded. The model object that drives the view, as shown in the MovieDetail struct below, contains a urlString. Since a SwiftUI View element does not have any lifecycle methods ...

When I try to update in the realm, it only updates in the 0th index. How can I fix this issue?

While working in Realm, I have assigned the id = 0 as the primary key with auto-increment functionality. However, when updating, it gets saved in the 0th index as declared in id: Int = 0. Every update I make ends up only affecting the 0th index. I need t ...

I require assistance in implementing a button for executing this specific HTML code

Can someone assist me in embedding my HTML code into a button so that when the button is clicked, my code executes? function loadProgressBar() { var bar = document.getElementById('progressBar'); var status = document.getElementById(&ap ...

Downgrading the node version on a Mac continues to display the previously installed version

I am currently in the process of downgrading my node version on a Mac terminal. sudo npm cache clean -f sudo npm install -g n sudo n 9.10.0 After executing the above commands, I checked the version and it remained the same as the previous version. npm - ...

Utilizing jQuery to Execute a Function Upon Addition or Removal of Class Names

Currently, I am working on a function that includes a conditional statement to display an alert when a specific class name is removed from a div layer. Below is the code snippet: <div class="ui-tabs-panel ui-tabs-hide">panel</div> <div>& ...

Tips for using CAShapeLayer in Swift to draw a line in the corner of a square

I've been working on a face recognition project using the Vision library, and I'm struggling with drawing lines using CAShapeLayer. Below is the code snippet after capturing the camera output: func captureOutput(_ output: AVCaptureOutput, didOut ...

How much does it typically cost to implement external libraries into a project?

Here are some of the most commonly used front-end web development libraries: jquery-min.js (95.9 kB) angular.min.js (108.0 kB) bootstrap.min.css (113.5 kB) bootstrap-theme.min.css (19.8 kB) bootstrap-fonts (185.7 kB) bootstrap.min.js (35.6 kB) All in al ...

Using the / (forward slash) in CSS styling statements

Similar Query: Understanding the CSS font shorthand syntax As I was examining the styling on Apple's website, I encountered a CSS rule that left me puzzled: body { font: 12px/18px "Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana, ...

Switch the video source using JavaScript

I've been experimenting with creating a custom dropdown (ul li list) that allows users to select a different video to play, which is then loaded into the background of the page. Once the user clicks on the dropdown, it should switch to a different vi ...

New to AppleScript: Encountered an unexpected identifier instead of the expected end of line

tell application "Microsoft Word" activate insert text "property eGrepx : "priceValue___11gHJ\">\\$\\d{2},\\d{3}.\\d{2}" " at end of text object of active document e ...

Building a stylish bootstrap button within the cell rows of a table using jquery

I need to insert a button in the "Details" column. <button class="btn btn-primary btn-fab btn-icon btn-round"> Here is my code: var tableRef = document.getElementById('ticker_table').getElementsByTagName('tbody')[0]; var ti ...