I'm trying to create following shape.
Almost I tried to create this image by following way. In order create this Image using HTML and CSS. I tried to use following code.
.left1{
float:left;
transform: rotate(180deg);
}
.halfCircleRight1{
height: 70px;
width: 70px;
border-top-right-radius: 10em;
border-bottom-right-radius: 10em;
background: #326d7d;
}
.halfCoverTop1 {
height: 35px;
width: 35px;
border-bottom-right-radius: 10em;
background: #ffffff;
}
.halfCoverBottom1{
height: 35px;
width: 35px;
border-top-right-radius: 10em;
background: #ffffff;
}
.left{
float:left;
}
.halfCircleRight{
height: 70px;
width: 70px;
border-top-right-radius: 10em;
border-bottom-right-radius: 10em;
background: #b1a51f;
}
.halfCoverTop {
height: 35px;
width: 35px;
border-bottom-right-radius: 10em;
background: #ffffff;
}
.halfCoverBottom{
height: 35px;
width: 35px;
border-top-right-radius: 10em;
background: #ffffff;
}
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
But some where I'm going wrong to achieve my desires output.I'm not able to figure out my approach. Could any one can please help achieve my actual output.
What about another idea using some SVG, pseudo-element and multiple background:
UPDATE
Here is another idea without the use of SVG and only CSS (I will rely on radial-gradient):
There are multiple possibilities to create this shape. Each one has its own pros and cons. You may decide which best suits your needs.
SVG Based Approach:
SVG is the recommneded and more appropriate way to create such shapes.
Step #1:
The idea is to draw a small component that is being repeated in your shape and then repeat it using SVG's patterns. We can use SVG's
path
element to create this shape and fill it with some color, gradient or pattern.Only one attribute
d
is used to define shapes inpath
element. This attribute itself contains a number of short commands and few parameters that are necessary for those commands to work.Below is the necessary code to create this shape:
I've used 3 commands inside path element. Below is a brief description:
M
command is used to define the starting point. It appears at the beginning and specify the point from where drawing should start.Q
command is used to draw curves.A
command is also used to draw curves.Working Example:
Output Image:
Below is the output of first step:
Step #2:
Now we will create a pattern that will repeat this shape. After creating this we will be a bit more closer to the final output.
Consider the below code:
Below is a brief description of above code:
<defs>
element is used to define graphics/elements for later use. Objects defined insidedefs
are not drawn immediately on screen. They will be referenced by other parts of the code in future.<pattern>
element defines a graphics object which can be redrawn at repeated x and y-coordinate intervals ("tiled") to cover an area. This pattern will be referenced byfill
/stroke
attributes of graphics elements.<rect>
element is used to draw rectangular area on screen. Notice thefill
attribute used on this element. This attribute is referencing the pattern defined above in<defs>
section. Now we are actually using this pattern to fill the rectangular area.Working Example:
Output Image:
Below is the result till now:
Step #3:
Finally we will create two patterns and apply it on 2 different
<rect>
elements to create the final output.Following code pattern will be used to create final output:
Most of the code is similar as described above. However notice the use of
<use>
element. Instead of definingpath
element in eachpattern
element, we have defined it once and copying it in 2 other places with<use>
element.The
<use>
element takes nodes from within the SVG document, and duplicates them somewhere else.Working Example:
Output Image:
Below is the final output image:
HTML/CSS Based Approach:
Although possible but I won't recommend this because a lot of elements will be required to create this shape which is won't be an efficient approach.
Working Example: