An issue with Safari rendering when using border radius with varying border width and color

I am looking to create a unique box design that features borders on the left and right sides with rounded corners. I also want to have different colors for each border.

When viewing the box in Chrome, the corners appear correctly except for some thin white lines. However, in Safari, there seems to be some rendering issues, especially with the left border where the radius is cut off, but you can see the color of the right border as a straight line on the left side (it's actually the color of the right border).

To get a better idea, please take a look at these two screenshots:

https://i.sstatic.net/LWMZP.png

https://i.sstatic.net/mjW4q.png

For further reference, here is a link to the CodePen I created:

https://codepen.io/Regnalf/pen/rNPPovV

Below is an example of the HTML and CSS code I used:

<article>
  <div class="t">Box</div>
  <div class="c">Content</div>
</article>

CSS:

body
{
  background-color: #eee;
}

article
{
  background-color: white;
  width: 10em;

  border-radius: 1em;
  overflow: hidden;

  border-left: 5px solid #00aaa1;
  border-right: 5px solid #005b74;
}

.t
{
  color: white;
  background-image: linear-gradient(90deg, #00aaa1, #005b74);
}

.t, .c {padding: 0.5em;}

I'm wondering if there is a way to make this design render properly in Safari as well. And ideally, it would be great if we could eliminate those thin white lines in Chrome too!

Answer №1

To address your issue, consider applying the gradient to the article element instead of the div.

article
{  
  background-image: linear-gradient(90deg, #00aaa1 0px, #005b74 100%);
  width: 10em;
  
  border-radius: 1em;
  overflow: hidden;
  
  padding-left: 5px;
  padding-right: 5px;
}

Border properties were replaced with padding for a similar outcome.

The background color was set for the box content and a bottom border added.

.c {
  background-color: white;
  border-bottom-left-radius: 1em;
  border-bottom-right-radius: 1em;
  border-top: hidden;
}

Testing was also conducted on an iPhone device as I don't have access to Safari desktop version.

View the demonstration here

Answer №2

Here is a suggestion you can try:

section {
  width: 15em; 
  border-radius: 2em;
  overflow: hidden;
  background-image: linear-gradient(45deg, #ff3366, #993366);
  background-repeat:no-repeat;
  padding-left:8px;
  padding-right:8px;
}
.h {
  color: black;
}
.h, .f {padding: 1em;}
.f {
  background-color: black;
  border-bottom-left-radius:25px;
  border-bottom-right-radius:25px;
}

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 Django static CSS won't load properly on the webpage

Despite browsing various posts related to my issue, I have been struggling to resolve the problem at hand (for instance, following this informative post: Django static files (css) not working). The challenge lies in getting my static CSS file to load prope ...

Adjust all children's height to match that of the tallest child

My nearly completed jQuery slideshow is working well except for one issue - the height of the slideshow remains fixed at the height of the first displayed slide, causing problems. View the issue here: . I have tried different jQuery solutions from StackOve ...

Using Flexbox CSS to Expand a Box According to its Content Size, Without Impacting Adjacent Rows

Is there a way to make the bottom-most row (highlighted in yellow) expand downward to fill available space? Check out this link for reference: https://jsfiddle.net/darrengates/oucvnfke/ I initially thought using: flex: auto; would solve the issue. Whil ...

Utilizing a dynamic URL to set the background image of a div element (with the help of

Currently, I am in the process of designing a user registration page that allows users to input an image URL and view a preview of the image within a designated div. The div already contains a default image set by a specific class. The HTML code for displa ...

Creating a switch statement that evaluates the id of $(this) element as a case

I have a menu bar with blocks inside a div. I am looking to create a jQuery script that changes the class of surrounding blocks in the menu when hovering over a specific one. My idea is to use a switch statement that checks the ID of $(this) and then modif ...

Struggling to align text alongside a left-floating image within a dialog box

I have a question as a beginner. I'm struggling to place text on the right side of an float: left <img> element within an md-dialog: <md-dialog aria-label="download" flex="60" ng-controller="viewerController"> <md-toolbar> ...

Is Angular4 preloaded with bootstrap library?

I started a new angular4 project and wrote the code in app.component.html <div class="container"> <div class="row"> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class ...

Error encountered while trying to load the fonts

Upon attempting to load fonts into the Spectacle boilerplate, I encountered the following error message: Failed to decode downloaded font: http://localhost:3000/assets/fonts/Overpass-Bold.ttf OTS parsing error: invalid version tag I've includ ...

Using CSS to overlay a fixed element with a specific z-index

HTML: <div class="wrap"> <div class="fixed"></div> </div> <div class="cover"></div> CSS: .cover{z-index: 10;} .wrap{position: relative; z-index: 1;} .fixed{position: fixed; display: block; z-index: 1;} Example: ...

Selenium: Utilizing the get_attribute() function with a CSS query

I am attempting to retrieve the value of the title attribute. There are multiple links on the page and I need to specifically select the first link and extract its title attribute. Here is the selenium command that I have used: self.se.get_attribute("c ...

Tips for shortening button text within a flex child element

I'm struggling to achieve a specific layout using flexbox. I require one child element that does not shrink, and two child elements that can shrink/grow and be truncated based on their content while considering the sizes of their content. My current ...

The novice image slideshow script in JavaScript is causing all images to disappear and generating errors

Trying to create a simple image slider that pulls information from various sources. CSS and HTML are set up properly, but adding the JavaScript logic causes all images to disappear. The console displays an error saying "Uncaught TypeError: Cannot read prop ...

Issues with CSS3 keyframe animations failing to function in Firefox and IE

My CSS code is functioning properly in Chrome and Safari, but not in Firefox, IE, and Opera when I create the @keyframes rotate {}. It seems that these 4 lines might be causing the issue: animation-duration: 4s; animation-timing-functio ...

the iframe is not properly displaying the embedded responsive page

The primary webpage incorporates the responsive mobile page created with the JQUERY SUPERSLIDES plugin. The mobile page appears correctly when viewed directly on an iPhone using Safari. However, when it is embedded in an iframe, it does not display as expe ...

How can I delete the black background from the ion-tab-bar in Ionic 7?

In my current project using Ionic 7, I have a navigation guide set up with 4 tabs. I am trying to customize the styling of these ion tabs by adding some custom CSS. The issue I'm facing is that despite my attempts to make the background transparent, ...

The website's navigation system effectively directs content within the initial 100% viewport

I have encountered a slight issue. I created a Sidebar Navigation with some added "hey's" to demonstrate the problem: * { margin: 0; padding: 0; font-family: 'Roboto', sans-serif; } nav { height: 100vh; width: 250px; borde ...

Having trouble with my phone screen not displaying my html navbar properly

Hi, I'm currently working on my website using tailwind css. I'm facing an issue with my navbar not displaying in full screen on mobile devices. Can someone please assist me with this? See a screenshot of the bug here You can visit the original ...

Switch out a static image for a dynamic YouTube video using CSS styling

I've been working on customizing a template website, and I want to switch out the current image for a YouTube video. I have the code from YouTube ready to go, but I'm not sure what changes need to be made in the template. Take a look at the CSS ...

Add flair to the elements contained within a div that has been assigned a class

What I am capable of doing: Creating HTML: <div id="test"> HELLO! <input type="text"> </div> Styling with CSS: #test { color:#F00; } #test input[type=text] { background-color:#000; } Now, if the #test is replaced with ...

Centralized Title / Side-aligned Menu

Good day, I am in need of assistance with a menu layout for my website. My goal is to have the title centered with the menu flexed out to the sides, but I'm encountering some issues. The colors included are just for testing purposes and will be update ...