Spaces between dotted outlines featuring a gradient backdrop

What causes the top edge gaps of the dashed border to be filled with blue color?
Why are the bottom edge gaps of the dashed border filled with white color?
...even when the background is set as a linear white-to-blue top-to-bottom vertical gradient.

Why do the left and right edge gaps of the dashed border not exhibit this issue?

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

The rendering above is produced by the code snippet below:

index.html

<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" media="all" href="mycss.css" />
</head>

<body>

<div class="wrapper" style="height: 500px; width: 500px; margin-bottom: 1%;">
    <div id="roundrec">Rounded Rect</div>
</div>

</body>
</html>

mycss.css

body
{
    font-family: "Segoe UI", Tahoma, Helvetica, freesans, sans-serif;
    font-size: 90%;
    margin: 10px;
    color: #333;
    background-color: #ff0000;
}


.wrapper
{
    display: table;
    table-layout: fixed;
    margin: 0px 0px .2% 0px;
    padding: 0px;
    border: 0px;
    border-collapse: separate;
    border-spacing: .2vmin; 
    vertical-align: middle; 
    font-size: 1vmin;
    overflow: hidden;
}

#roundrec
{
    display: table-cell; 
    width: 100%; 
    height: 100%; 

    color:#ccc; 
    background: -webkit-linear-gradient(#FFFFFF, #0000FF); /* Chrome 10+, Safari 5.1+ */
    background: -o-linear-gradient(#FFFFFF, #0000FF); /* Opera 11.1+ */
    background: -moz-linear-gradient(#FFFFFF, #0000FF); /* Firefox 3.6+ */
    background: linear-gradient(#FFFFFF, #0000FF); /* Standard syntax (must be last) */ 
    padding: 0 0;
    margin: 10px 10px;
    border-collapse: separate;
    border: 2vmin dashed #ccc;
    border-radius: 10%;
    cursor: default;
    vertical-align: middle; 
    text-align: center; 
    
    font-size: 7em;
    font-weight: 700;
}

What steps can I take to ensure that the upper and lower edge gaps appear like this?:

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

...or at least resemble this?:

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

EDIT:
The related question fails to address the gaps in the rounded corners of the dashed border because the padding box lacks rounded corners.

Answer №1

To achieve the desired effect of having a gradient color under the border, one can utilize the CSS property background-clip with the value set to padding-box. I experimented with combining background-clip: border-box and background-repeat: no-repeat, which resulted in a solid color appearing under the border but not the intended gradient.

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

Email-box appears in a seemingly "random" location

I am currently engrossed in my informatics project, which involves building a sample dating site. However, I have encountered some difficulties in getting everything to align correctly. Everything was working fine until my email box appeared in the wrong p ...

I am experiencing issues with my PHP quiz application; it is malfunctioning when I try

In my PHP MySQL quiz application, I have developed two sections: one for students and another for admins. In the admin area, there is an "addquestion" page where the code is as follows: <form class="form-horizontal " action="addquestion.php" method=" ...

Tips for simultaneously hovering over SVG and text elementsFeel free to hover over both SVG

After importing an SVG image and creating a box containing both an icon and text, I noticed that when hovering over the box, only the color changes to yellow while the SVG remains unaffected. How can I resolve this issue so that both the text and icon chan ...

What are the steps to customize the appearance of a ComboBox using CSS?

I'm struggling to style the items in a combo box when it's dropped down. Currently using vaadin-time-picker on Svelte, but my issue persists due to the combo box included. Despite experimenting with CSS, I haven't had any success. My goal i ...

One-line decorative border design

I'm experiencing an issue with a PNG image that I want to use as a border-image. The image is 10px x 1px in size, but when I try to use it, it only appears in the corners and doesn't repeat across the entire border. Can anyone help me figure out ...

Creating a Masonry Slider with varying heights and widths of images is a simple and effective way to showcase diverse content in a visually

I am looking to implement a unique grid image slider that accommodates images of varying heights and widths. I envision something similar to the example shown below. The image showcases a pattern where the sliders alternate between square images and two r ...

How do I enable alt text visibility for images in my WordPress theme Kallyas?

I am currently in the process of making my company's website more inclusive by ensuring all images have proper alt text. However, I am facing a challenge in seeing the alt text that I add through the WordPress CMS when viewing the HTML code. Please re ...

Verify the accuracy of the color value on a web page using Selenium in Java

As a beginner in using Selenium with Java, I encountered an issue related to a symbol in my connected class turning green. I needed to assert whether the symbol actually changed its color. Below is the code snippet that I used: Boolean connectionSymbolG ...

Automatically refresh HTML table updates

I'm working with an HTML table and I want to use jQuery to customize it in the following way: If I input a future date, I want jQuery to change the date's color to green. For past dates, I want jQuery to change the date's color to red. Ca ...

Display a div using jQuery when it reaches halfway the height of another div

I have a code snippet that hides the .wp-filter when reaching the bottom of the .wpgb-layout jQuery(window).bind('scroll', function() { if(jQuery(window).scrollTop() >= jQuery('.wpgb-layout').offset().top + jQuery('.w ...

What is the best way to responsively position a bootstrap button?

Recently diving into the world of CSS and Bootstrap, I encountered an issue with a Bootstrap button on my webpage. Despite my efforts, I couldn't seem to make it responsive to window resizing. It feels like there's a glitch in the code somewhere, ...

What could be the reason for the checkbox being toggled twice?

Here is the code snippet I am working with: $("input[type='checkbox']").each(function() { var current = $(this); $("label[for='" + current.attr("id") + "']").on('click', function() { current.change(); al ...

Aligning the stars with CSS

One of the components I have deals with a star rating system, and I thought it would be cool to use Font Awesome icons for half stars. Everything is working well except for the CSS styling aspect. While I managed to position some of the stars correctly by ...

The width of the div element is not functioning properly in my code

<div id="content" style="background-color:#ffffff; width:600px;"> This code snippet creates a div with a white background color that stretches across the entire width of the page. To limit its width to a specific size, you can adjust the width prope ...

Adjusting image size according to browser dimensions

I've been struggling to resize a background image on my Square space website dynamically based on the user's browser window size. If the window width drops below a certain point, I want the image to adjust accordingly while maintaining its aspect ...

Ensuring the input field and button are positioned in a horizontal line

Currently, I am developing a to-do list application using React and Chakra UI. I am trying to align the input field and the button on the same line for a more organized layout. This is the current layout: image I aim to achieve a design similar to this: ...

Is there a way to store mathematical equations in a database efficiently?

My website is built in Asp.net and I am utilizing MySql as my database. I have several sample math papers saved in Microsoft Office Word format. What I need is an HTML input tool, such as a textbox or editor, that will allow me to directly copy mathematica ...

What is the best way to adjust the size of the footer container?

Utilizing Bootstrap to practice coding as a beginner has been a learning process for me. Recently, I encountered an issue with the container size of the footer. view image description here Upon inspecting the photo in the link, I realized that the foote ...

Transitioning smoothly from mobile to tablet views with the sidebar activated in Semantic-UI

My HTML includes a pointing menu when the screen width exceeds 630px. Below 630px, it switches to a sidebar with a menu button: <nav class="ui inverted sidebar menu vertical slide out" id="m_menu"> <a href="index.php" ...

Is there a way to ensure the scroll bar remains at the bottom as new data is added?

Hey there Coding Enthusiasts! I'm currently working on developing a chat system and one of the features I'm trying to implement is keeping the scroll bar at the bottom. The goal is to ensure that when someone sends a message, the user doesn' ...