Styling with CSS to create wavy borders for sgwiggle design

I successfully implemented the borders below using CSS with the following code:

.bottom,
.up,
.left,
.right {
  height: 30vh;
  position: relative;  
  background: black;
  margin-bottom: 15px;
  width: 50vw;
  margin-inline: auto;
}

/* Text styling */
.bottom,
.up,
.left,
.right {
  color: #fff;
  text-align: center;
  font-weight: bold;
  font-size: 24px;
  padding-top: 25px;
  padding-bottom: 25px;
}
/* */

.bottom::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  background-repeat: repeat;
  height: 10px;
  background-size: 20px 20px;
  background-image: radial-gradient(
    circle at 10px -5px,
    transparent 12px,
    #fff 13px
  );
}
.bottom::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  background-repeat: repeat;
  height: 15px;
  background-size: 40px 20px;
  background-image: radial-gradient(
    circle at 10px 15px,
    #fff 12px,
    transparent 13px
  );
}

.up::before {
  content: "";
  position: absolute;
  transform: rotate(180deg); /*Very important*/
  left: 0;
  top: 0;
  right: 0;
  background-repeat: repeat;
  height: 10px;
  background-size: 20px 20px;
  background-image: radial-gradient(
    circle at 10px -5px,
    transparent 12px,
    #fff 13px
  );
}

.up::after {
  content: "";
  position: absolute;
  transform: rotate(180deg);
  left: 0;
  top: 0;
  right: 0;
  background-repeat: repeat;
  height: 15px;
  background-size: 40px 20px;
  background-image: radial-gradient(
    circle at 10px 15px,
    #fff 12px,
    transparent 13px
  );
}

Here is the corresponding HTML:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Static Template</title>
    <link rel="stylesheet" href="main.css" />
  </head>
  <body>
    <div class="bottom">4</div>
    <div class="up">5</div>
    <div class="left">6</div>
    <div class="right">7</div>
  </body>
</html>

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

Now I am trying to achieve similar results for the left and right borders. Below is the CSS I have so far:

.left,
.right {
  overflow: hidden;
}

.right::before {
  content: "";
  position: absolute;
  transform: rotate(-90deg);
  width: 100%;
  right: 0;
  top: 2px;
  bottom: 0;
  left: 49%;
  background-repeat: repeat;
  height: 9px;
  background-size: 20px 20px;
  background-image: radial-gradient(
    circle at 10px -5px,
    transparent 12px,
    #fff 13px
  );
}

.right::after {
  content: "";
  position: absolute;
  transform: rotate(-90deg); /*Very important*/
  width: 100%;
  right: 0;
  top: -1px;
  bottom: 0;
  left: 48.5%;
  background-repeat: repeat;
  height: 15px;
  background-size: 40px 20px;
  background-image: radial-gradient(
    circle at 10px 15px,
    #fff 12px,
    transparent 13px
  );
}

.left::before {
  content: "";
  position: absolute;
  transform: rotate(90deg); /*Very important*/
  width: 100%;
  top: 2px;
  bottom: 0;
  left: -49%;
  background-repeat: repeat;
  height: 9px;
  background-size: 20px 20px;
  background-image: radial-gradient(
    circle at 10px -5px,
    transparent 12px,
    #fff 13px
  );
}

.left::after {
  content: "";
  position: absolute;
  transform: rotate(90deg);
  width: 100%;
  top: -1px;
  bottom: 0;
  left: -48.5%;
  background-repeat: repeat;
  height: 15px;
  background-size: 40px 20px;
  background-image: radial-gradient(
    circle at 10px 15px,
    #fff 12px,
    transparent 13px
  );
}

This is the current outcome: https://i.sstatic.net/wXXaH.png

Can you help me identify what may be missing from my approach?

Answer №1

Perhaps you can find some assistance here

For example, take a look at the code snippet below:

.box {
  --mask: 
    radial-gradient(30px at 25% 0,#0000 98%,#000) 50% 30px/120px 100% repeat-x,
    radial-gradient(30px at 75% 50%,#000 99%,#0000 101%) top/120px 60px repeat-x;
  -webkit-mask: var(--mask);
          mask: var(--mask);
}

div {
  width:100%;
  height:200px;
  background: black;
}
<div class="box"></div>

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

Creating a dynamic logo image in a Bootstrap 4 navbar that seamlessly overlaps while maintaining full responsiveness is a simple yet effective way to elevate

Is it possible to create a responsive overlapping logo on a Bootstrap navbar without affecting the hamburger menu icon? Good day! I am currently using Laravel Spark along with Bootstrap for my project, and I have encountered a specific challenge: How ca ...

"Implementing a function to automatically input a selected value from a dropdown menu into a text field

I'm facing an issue and need some help. I have a form with one select field and one text field. What I want is for the text field to display a value corresponding to the option selected in the select field. For example, if I choose "B" from the select ...

variety of heights in the product grid for an eclectic look

Hey there! I'm currently experimenting with a simple product grid for testing purposes only. It's not a final design, just trying to work out some kinks. One issue I'm facing is with the heights of the elements. When text spans over two line ...

Struggling with aligning buttons in a horizontal navigation bar

I have been struggling to center the buttons on my navigation bar for quite some time now, despite my efforts searching through Google (I'm still a beginner in CSS). Below is the code I have for the navbar (excluding my numerous unsuccessful attempts ...

The div containers are unable to be positioned side by side

Hey there, I'm having trouble with my coding right now. (I'm not sure if you can see it, but the code is creating a div - frustrating). Here's an image of the code: https://i.sstatic.net/j1yW1.png No matter what code I try to use to align t ...

Triangulating polygons on a spherical globe

Can all polygons be filled realistically? Take a look at this Codepen. It seems that the ThreeGeoJSON plugin is only able to create outlines for polygons, not fill them. I also experimented with using Earcut for triangulation. drawThreeGeo(data, radius, & ...

What is the most effective method for arranging a block of text on the left side with an image on the right?

I am looking to design a container with text on one side and an image on the other. The div should be around 300px in height. I've been experimenting with different approaches but would like to adhere to standard practices for this layout. Your help i ...

Utilizing the box-shadow feature on Bootstrap 4's card element

I'm having an issue with applying a simple shadow to a cards component. The shadow appears mirrored and out of place. My suspicion is that it might be related to the margin-bottom property, but I'm unable to pinpoint the exact reason behind this ...

Partial height side navigation bar

Check out this JS Fiddle: https://jsfiddle.net/wqbn6pe6/2/ This is a simple side navigation, but the grid layout is causing the sidebar not to stretch to the bottom even though it's set at 100% height. Any suggestions or solutions? Here's the ...

Guide on inserting an image within text with CSS3

I am attempting to modify text appearance by using a mask on mouse hover. Despite my best efforts, I cannot seem to make the image-mask method work as intended. My aim is to embed images within text. HTML: <div id="ALEX">ALEX</div> ​CSS: ...

Tips for integrating a calendar into a website

After researching, I came across this code for adding a calendar to my webpage: <!DOCTYPE html> <html> <head> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/ ...

``To utilize the ng-class variable within a controller, one can simply assign the desired

How can I change the color of a div to green using AngularJs when a file is selected? html <div class="text-arrow" ng-class="{activeBackground:applyActive}">File Selection<span class="arrow-div"></span></div> css .activeBack ...

Challenges with Z-index and layering dynamics

I'm having trouble getting z-index to work. I've searched online but can't find a solution. How can I make the .navigation class have a lower z-index than the .mobilenav and .mobilenavclosed classes so that they appear above everything else ...

Verify whether the value is in the negative range and implement CSS styling in React JS

I have been developing a ReactJS website where I utilize Axios to fetch prices from an API. After successfully implementing this feature, I am now looking for a way to visually indicate if the 24-hour change percentage is positive by showing it in green, a ...

Learn how to direct the focus onto the close button when using a Bootstrap modal with content displayed as an image link and an overlapping

My modal contains an image-link with an overlapping close button. Unfortunately, the close button is not receiving focus - instead, the link is being clicked. I've made some adjustments but can't seem to get the close button focused while maintai ...

How to keep Vuetify component at the top of the v-layout?

https://i.stack.imgur.com/cKdsk.png I am in the process of creating a website using vuetify and nuxt. My goal is to specify the max-width property for the expansion panel UI component (https://vuetifyjs.com/en/components/expansion-panels). Here is my curr ...

Troubleshooting problem with CSS aligning <dl> and <dd> tags

Utilizing <dt> and <dd> typically assumes a single line definition for dd. However, in my scenario, I have multiple entries for the definition that I need to correctly display (the exact method will be clarified after reviewing the attached ima ...

Close the overlay by clicking outside of it

I'm working on creating a unique pop-up window that appears when a customer adds a product to their cart. The design features red and green background divs with a darker overlay (#overlay-daddy) and a white child div (#overlay). My issue arises from ...

Is there a way to customize the default settings for a blueprint’s menu item?

https://i.sstatic.net/aNeJY.jpg In my react project, I implemented the Menu using MenuItem from '@blueprintjs/core'. The issue I encountered is that when hovering over a Menu item with children, they open from the right side. Is there a way to m ...

It is not possible to place the cursor before a non-contenteditable div within a contenteditable div

Here is the layout I am working with: <div contenteditable=true> /// <div contenteditable=false>not editable</div> /// </div> One problem I'm facing is that when the non-contenteditable div is the first element on a ...