Clip Path Buttons For Circular Nav - html

I need to make a circular nav with a transparent center and buttons shaped like the bars around this Iron Man thing.
Below is my attempt using clip path... is there a way to do curves to make this easier, or must I draw many more points to make this look good?
CSS
.circle-new-btn {
background: rgba(0,0,0,1.00);
height: 300px;
width: 300px;
-webkit-clip-path: polygon(52% 21%, 57% 22%, 61% 24%, 65% 28%, 68% 31%, 59% 48%, 56% 46%, 53% 44%, 49% 43%, 45% 42%, 41% 44%, 38% 47%, 34% 50%, 32% 28%, 36% 25%, 40% 24%, 46% 22%);
clip-path: polygon(52% 21%, 57% 22%, 61% 24%, 65% 28%, 68% 31%, 59% 48%, 56% 46%, 53% 44%, 49% 43%, 45% 42%, 41% 44%, 38% 47%, 34% 46%, 32% 28%, 36% 25%, 40% 24%, 46% 22%);
}
.circle-new-btn:hover {
background: rgba(111,111,0,1.00);
}
HTML
<div class="circle-new-btn"></div>

Here is an idea how you can create this shape using CSS:
.box {
width:200px;
height:100px;
padding:20px 0;
box-sizing:border-box;
color:#fff;
text-align:center;
background:
radial-gradient(circle at 50% 160%,transparent 45%,blue 44.5%,blue 85%,transparent 85%);
-webkit-clip-path: polygon(0 0, 100% 0, 75% 90%, 25% 90%);
clip-path: polygon(0 0, 100% 0, 75% 90%, 25% 90%);
}
<div class="box">
Some text
</div>
Then you can simply apply some rotation to place the buttons around the big circle.

Related

CSS Clip Path - Invalid Property Value [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am trying to create a complex clip-path from a logo in CSS and the console is giving me a Invalid Property Value I have calculated the X & Y axis based on a width and height of 508px x 190px
This is the logo I am working from
And this is the css:
.container {
width: 508px;
height: 190px;
margin: 0 auto;
background: #fff;
border: 1px solid #ebebeb;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAHlBMVEUAAABkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGSH0mEbAAAACnRSTlMAzDPDPPPYnGMw2CgMzQAAAChJREFUKM9jgAPOAgZMwGIwKkhXQSUY0BCCMxkEYUAsEM4cjI4fwYIAf2QMNbUsZjcAAAAASUVORK5CYII=');
background-size: 10px;
padding-left: 5px;
padding-top: 5px;
}
.logo-clip {
width: 100%;
height: 100%;
background-color: purple;
clip-path:
polygon(
0 0,
12% 0,
12% 75%,
26% 75%,
26% 48%,
37% 48%,
37% 29%,
26% 29%
26% 0,
37% 0,
57% 69%,
57% 0,
69% 0,
69% 34%,
82% 0,
98% 0,
78% 48%,
100% 100%,
84% 100%,
69% 63%,
69% 100%,
51% 100%,
37% 49%,
37% 100%,
0 100%,
0 0
);
}
HTML:
<div class="container">
<div class="logo-clip"></div>
</div>
Can anyone tell me what is wrong I calculated 26 points to work from and I have 26 X/Y pairs in the polygon 🤦🏻‍♂️
You're missing a comma after 26% 29%
You are missing a , after 26% 29% in the clip-path.
.container {
width: 508px;
height: 190px;
margin: 0 auto;
background: #fff;
border: 1px solid #ebebeb;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAHlBMVEUAAABkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGSH0mEbAAAACnRSTlMAzDPDPPPYnGMw2CgMzQAAAChJREFUKM9jgAPOAgZMwGIwKkhXQSUY0BCCMxkEYUAsEM4cjI4fwYIAf2QMNbUsZjcAAAAASUVORK5CYII=');
background-size: 10px;
padding-left: 5px;
padding-top: 5px;
}
.logo-clip {
width: 100%;
height: 100%;
background-color: purple;
clip-path:
polygon(
0 0,
12% 0,
12% 75%,
26% 75%,
26% 48%,
37% 48%,
37% 29%,
26% 29%,
26% 0,
37% 0,
57% 69%,
57% 0,
69% 0,
69% 34%,
82% 0,
98% 0,
78% 48%,
100% 100%,
84% 100%,
69% 63%,
69% 100%,
51% 100%,
37% 49%,
37% 100%,
0 100%,
0 0
);
}
<div class="container">
<div class="logo-clip"></div>
</div>
Everything is right just the color needs to be rgb(6, 173, 173) and there is a syntax mistake of a , after 26% 29%.
.logo-clip {
width: 100%;
height: 100%;
background-color: rgb(6, 173, 173);
clip-path: polygon(
0 0,
12% 0,
12% 75%,
26% 75%,
26% 48%,
37% 48%,
37% 29%,
26% 29%,
26% 0,
37% 0,
57% 69%,
57% 0,
69% 0,
69% 34%,
82% 0,
98% 0,
78% 48%,
100% 100%,
84% 100%,
69% 63%,
69% 100%,
51% 100%,
37% 49%,
37% 100%,
0 100%,
0 0
);
}

How to create complex 3d shapes in css ? (duct tape band)

I'd like to create a scotch tape band design on my website. I would like it to look almost like that :
I designed yet the clean tape but I cannot manage to create the bendings (circled on the picture) properly.
this is what I have yet.
body {
overflow: hidden;
}
.duct-tape {
display: flex;
justify-content: space-around;
align-items: space-around;
transform-origin: center;
position: absolute;
top: 50%;
left: 50%;
width: 100vw;
background-color: yellow;
overflow: hidden;
}
.duct-tape:nth-of-type(1) {
transform: translate(-50%, -50%) rotateZ(-20deg);
}
.duct-tape:nth-of-type(2) {
transform: translate(-50%, -50%) rotateZ(30deg);
}
.duct-tape > .shadow {
display: block;
position: absolute;
height: .3px;
width: 50px;
transform: rotateZ(-30deg) translateX(13px);
border-radius: 100%;
box-shadow: .1em .1em .25em rgb(130, 130, 0);
}
/* debug code */
.circle {
content: "";
display: block;
border-radius: 100px;
width: 30px;
height: 30px;
border: 2px solid lightblue;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-60%, -60%);
}
<body>
<div class="duct-tape">
<span>any text</span>
<span>any text</span>
</div>
<div class="duct-tape">
<span>any text</span>
<span>any text</span>
<span class="shadow"></span>
</div>
<!-- debug code -->
<span class="circle"></span>
</body>
Yet I thought about create little shadow elements (class shadow in duct-tape in the snippet) that would act like the bendings. I thought about svg too, but it doesn't seem I can easily create such an svg. I know css packs up 3D transforms, could it help me or this is too specific to be properly done using css 3D transforms ? Any idea of easier ways to do it ?
You may take a look at clip-path, rgba() colors and gradient.
here is a quick example to show the idea.
body {
background: yellow;
}
span {
--rt: 45deg;
position: absolute;
height: var(--ht, 400px);
width: var(--wdt, 50px);
background: linear-gradient(30deg, transparent 30%, rgba(255, 255, 255, 0.3) 32%, transparent 33%), radial-gradient(circle at 60% 40%, transparent 15px, rgba(255, 255, 255, 0.25) 17%, transparent 20%) rgba(0, 0, 0, 0.075);
box-shadow: 0 0 2px rgba(255, 255, 255, 0.6);
top: 50%;
left: 50%;
margin: -200px -25px;
transform: rotate(var(--rt));
clip-path: polygon(1% 0%, 19% 1%, 30% 0%, 38% 0%, 48% 1%, 58% 3%, 62% 3%, 79% 3%, 73% 1%, 84% 0%, 87% 0%, 91% 4%, 92% 2%, 99% 0%, 96% 5%, 96% 20%, 100% 34%, 100% 46%, 99% 54%, 95% 57%, 87% 69%, 100% 77%, 100% 82%, 100% 89%, 100% 96%, 90% 99%, 76% 100%, 71% 97%, 63% 100%, 54% 99%, 51% 100%, 37% 98%, 34% 100%, 21% 99%, 17% 100%, 14% 98%, 10% 100%, 3% 98%, 3% 100%, 0% 85%, 4% 80%, 0% 74%, 4% 55%, 6% 45%, 3% 40%, 0% 34%, 6% 25%, 4% 16%, 1% 13%);
}
span:nth-child(2) {
--rt: -45deg;
--ht: 450px;
background-size: 150% 200%;
clip-path: polygon(0 0, 13% 2%, 22% 0%, 28% 0%, 34% 2%, 46% 2%, 60% 2%, 69% 3%, 79% 1%, 80% 0%, 90% 0%, 93% 3%, 100% 4%, 99% 98%, 97% 100%, 87% 99%, 80% 100%, 74% 99%, 68% 100%, 60% 99%, 50% 100%, 43% 97%, 33% 96%, 31% 98%, 24% 99%, 20% 100%, 14% 98%, 9% 100%, 0% 100%);
}
span:nth-child(3) {
--rt: -45deg;
--wdt: 40px;
--ht: 200px;
left: 25%;
background-size: 110% 200%;
}
span:nth-child(4) {
--rt:15deg;
--wdt: 40px;
--ht: 150px;
left: 25%;
background-size: 40% 50%;
clip-path: polygon(0 0, 13% 2%, 22% 0%, 28% 0%, 34% 2%, 46% 2%, 60% 2%, 69% 3%, 79% 1%, 80% 0%, 90% 0%, 93% 3%, 100% 4%, 99% 98%, 97% 100%, 87% 99%, 80% 100%, 74% 99%, 68% 100%, 60% 99%, 50% 100%, 43% 97%, 33% 96%, 31% 98%, 24% 99%, 20% 100%, 14% 98%, 9% 100%, 0% 100%);
}
<span></span>
<span></span>
<span></span>
<span></span>
gradient linear,radial and conic can be used via background and resized and repeated or not, clip-path can allow you to cut off some pieces . a usefull tool to help you https://bennettfeely.com/clippy/
mask svg is also a possibility instead clip-path or mixed with.

Creating a custom checkbox using clip-mask

So I'm trying to create a custom checkbox using CSS and clip-path. I have that creating and working just fine. Now the problem is when I check the box the border disappears. Not sure why this is happening. Any help would be great. Also, here is a link to the codepen that I'm currently working on. https://codepen.io/Brushel/pen/qPovdB?editors=0110
body {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
margin-top: 2em;
}
.title {
text-align: center;
font-weight: 300;
}
label[for="checked"] {
padding-right: 10px;
padding-left: 10px;
}
#checked[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 1px solid #333;
height: 25px;
width: 25px;
cursor: pointer;
}
#checked[type="checkbox"]:after {
-webkit-clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
background: #333;
height: 25px;
width: 25px;
}
#checked[type="checkbox"]:checked {
-webkit-clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
background: #333;
height: 25px;
width: 25px;
-webkit-transition-duration: .3s;
transition-duration: .3s;
}
label[for="customcheckbox"] {
padding-right: 10px;
padding-left: 10px;
}
#customcheckbox[disabled="disabled"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 0.5px solid #b3b3b3;
height: 25px;
width: 25px;
cursor: not-allowed;
}
#customcheckbox[disabled="disabled"] {
background: #ccc;
}
#three[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 1px solid #333;
height: 25px;
width: 25px;
}
#three[type="checkbox"]:not(:checked) {
background: white;
}
#three[type="checkbox"]:checked {
-webkit-clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
background: #333;
height: 25px;
width: 25px;
}
#three[type="checkbox"]:after {
-webkit-clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
clip-path: polygon(21% 40%, 21% 40%, 8% 54%, 25% 68%, 36% 77%, 47% 65%, 48% 64%, 64% 47%, 75% 35%, 93% 13%, 81% 4%, 36% 54%);
background: #333;
height: 25px;
width: 25px;
}
<body>
<div class='container'>
<h4 class='title'>Checkboxes Via Clip-Path</h4>
<label for='checked' id='plus'>This</label>
<input id='checked' type='checkbox'>
<label for='checked' id='plus'>That</label>
<input id='checked' type='checkbox'>
<!-- / Start of the second checkbox -->
<h4 class='title'>Disabled Checkbox</h4>
<label for='customcheckbox' id='plus'>This</label>
<input disabled='disabled' id='customcheckbox' type='checkbox'>
<label for='customcheckbox' id='plus'>That</label>
<input disabled='disabled' id='customcheckbox' type='checkbox'>
<h4 class='title'>Checkbox via SVG</h4>
<label for='three'>This</label>
<input id='three' type='checkbox'>
<label for='three'>That</label>
<input id='three' type='checkbox'>
</div>
</body>

How to make p:wizard tabs looks like arrows?

How to make the p:tab in p:wizard looks like a arrow ,
something like the attached picture
Thank you in advance.
You can do this via CSS:
.firstTab{
line-height: 43px;
text-align:center;
height:60px;
width:210px;
-webkit-clip-path: polygon(0% 0%, 75% 0%, 100% 50%, 75% 100%, 0% 100%);
clip-path: polygon(0% 0%, 75% 0%, 100% 50%, 75% 100%, 0% 100%);
}
.middleTab{
line-height: 43px;
text-align:center;
margin-left: -30px !important;
height:60px;
width:210px;
-webkit-clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%);
clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%);
}
.lastTab{
line-height: 43px;
text-align:center;
margin-left: -85px !important;
height:60px;
width:220px;
-webkit-clip-path: polygon(25% 0%, 100% 1%, 100% 100%, 25% 100%, 55% 50%);
clip-path: polygon(25% 0%, 100% 0%, 100% 100%, 25% 100%, 50% 50%);
}
And in your xhtml file:
<p:tabView activeIndex="#{declarationMBean.activeIndex}" style="align-content: center; background: #67a3cf;" >
<p:ajax event="tabChange" listener="#{declarationMBean.onTabChange}" />
<p:tab id="tab_0" title="Example" titleStyleClass="firstTab" >
.
.
.
<p:tab id="tab_2" titleStyleClass="middleTab">
.
.
<p:tab id="tab_3" titleStyleClass="middleTab">
.
.
<p:tab id="tab_4" titleStyleClass="lastTab">

How to working with shape (polygon) in different browser?

I am doing the shape using css in my website.
It work well in chrome, but when open in mozilla, internet explorer, it can't function.
Anyone know how to fixed it?
Here is the fiddle
http://fiddle.jshell.net/dm3qe27o/2/
<div class="index-main-wrapper">
<div class="home-left-shape"></div>
<div class="home-right-shape"></div>
<div style="clear:both;"></div>
</div>
.home-left-shape {
height:100vh;
width:50vw;
float:left;
background-color:#bfb6a5;
background-size:cover;
-webkit-shape-outside: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%);
shape-outside: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%);
-webkit-clip-path: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%);
-webkit-shape-margin: 20px;
}
.home-right-shape {
height:100vh;
width:50vw;
float:right;
background-color:#bfb6a5;
background-size:cover;
-webkit-shape-outside: polygon(0% 100%, 100% 0%, 100% 100%, 0% 100%);
shape-outside: polygon(0% 100%, 100% 0%, 100% 100%, 0% 100%);
-webkit-clip-path: polygon(0% 100%, 100% 0%, 100% 100%, 0% 100%);
-webkit-shape-margin: 20px;
}
use different browser
-webkit-shape-outside: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%); -mozila & chrom
-moz-shape-outside: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%); - mozila
-o-shape-outside: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%); - opera
-ms-shape-outside: polygon(0% 0%, 0% 0%, 100% 100%, 0% 100%); - Internet Exploler