How to make angles around button like that? - html

i need to make angles around the button.
I have tried made by ::after ::before, but i cant
Original: bottom of this site
https://kirarock.team/
[enter image description here][1]
my code is here
https://codepen.io/Artyom2022/pen/LYmoaOY
[1]: https://i.stack.imgur.com/M0qgS.png
Thanks in advance

I have used SCSS
for made angles i have used transform-origin;
$clip_input: polygon(2% 0, 100% 0, 100% 100%, 7% 100%);
$clip_submit: polygon(85% 0, 97% 51%, 85% 100%, 15% 100%, 3% 50%, 15% 0);
$border-color: #fff;
.form {
display: grid;
grid-template: 1fr / repeat(2, 1fr);
gap: 70px;
}
.button {
grid-column: 1/3;
align-self: center;
justify-self: center;
text-align: center;
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 1fr 1fr 1fr;
justify-content: center;
&__wrapper {
background-color: #00c9ff;
clip-path: polygon(85% 0, 97% 51%, 85% 100%, 15% 100%, 3% 50%, 15% 0);
padding: 2px;
display: inline-block;
input {
clip-path: polygon(85% 0, 97% 51%, 85% 100%, 15% 100%, 3% 50%, 15% 0);
background-color: black;
border: none;
padding: 15px 57px;
color: #00c9ff;
font-weight: 100;
font-size: 2rem;
line-height: 130%;
text-align: center;
letter-spacing: 0.3em;
text-transform: uppercase;
cursor: pointer;
font-family: RobotoCondensed, sans-serif !important;
.button:hover {
background-color: #00c9ff;
color: black;
}
}
}
span:first-child {
margin-right: 25px;
justify-self: end;
top: 0;
display: grid;
&::before {
transform-origin: bottom right;
display: inline-block;
content: '';
background-color: #00C9FF;
width: 1px;
transform: rotate(45deg);
}
&::after {
transform-origin: top left;
display: inline-block;
content: '';
background-color: #00C9FF;
width: 1px;
transform: rotate(-45deg);
}
}
span:last-child {
margin-left: 25px;
justify-self: start;
top: 0;
display: grid;
&::before {
transform-origin: bottom right;
display: inline-block;
content: '';
background-color: #00C9FF;
width: 1px;
transform: rotate(-45deg);
}
&::after {
transform-origin: top left;
display: inline-block;
content: '';
background-color: #00C9FF;
width: 1px;
transform: rotate(45deg);
}
}
<div class="button">
<span></span>
<div class="button__wrapper"><input class="submit" type="submit" value="Send">
</div>
<span></span>
</div>

Related

Display child above all other elements

does anyone know how I can center the white circle into to middle of the blue circle and set the white circle above all other elements? I tried with relative and absolute positioning and with the z-index but I couldnt get it to work. I'm kinda a noob in CSS
.start-container {
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas: "header" "startpage" "footer";
}
.header {}
.header-shape {
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-shape {
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
background-color: blue;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0, 0, 0, 0.60));
}
.profile-picture {
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin: -50% 0 0 -50%;
}
.startpage {}
.footer {
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-shape">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
If you give your shape a z-index, it will put it on top. Make it flex with justify-content and align-items center and that will centre your profile (after removing the absolute positioning):
.start-container {
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas: "header" "startpage" "footer";
}
.header {}
.header-shape {
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-shape {
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
background-color: blue;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0, 0, 0, 0.60));
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.profile-picture {
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
}
.startpage {}
.footer {
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-shape">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
Per comment, if you want blue circle (changed to red in example below) below and white above, you would need to have an extra object otherwise the white circle will always be on the same stacking context as it's parent:
.start-container {
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas: "header" "startpage" "footer";
}
.header {}
.header-shape {
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-placement {
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
}
.profile-placement--shape {
background-color: red;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0, 0, 0, 0.60));
}
.profile-placement--picture {
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.profile-picture {
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
}
.startpage {}
.footer {
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-placement profile-placement--shape">
</div>
<div class="profile-placement profile-placement--picture">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>
Just adjust the margin with the remaining height and width on the profile-picture class.
The remaining size is 10% height and 10% weight. So there will be +5%(-45%) on the left margin and +5%(-45%) on the top margin. It will make the circle center
.start-container{
height: 100vh;
display: grid;
grid-template-rows: 20% 65% 15%;
grid-template-areas:
"header"
"startpage"
"footer"
;
}
.header{
}
.header-shape{
height: 100%;
background-color: blue;
clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0% 100%);
}
.profile-shape{
position: absolute;
top: 7vw;
left: 65vw;
width: 10vw;
height: 10vw;
background-color: blue;
border-radius: 50%;
filter: drop-shadow(0px 3px 30px rgba(0,0,0,0.60));
}
.profile-picture{
width: 90%;
height: 90%;
background-color: white;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin: -45% 0 0 -45%;
}
.startpage{
}
.footer{
background-color: yellow;
}
<div class="start-container">
<div class="header">
<div class="profile-shape">
<div class="profile-picture"></div>
</div>
<div class="header-shape"></div>
</div>
<div class="startpage"></div>
<div class="footer"></div>
</div>

Css Border Polygon: I'm new Reactjs and I try to find how to css like this img but i can't find it

I want to css a border outline like this and i use polygon but it lose 2 egde
I want to create a button like a button in LOL Website: https://www.leagueoflegends.com/en-us/how-to-play/
thanks
CSS code:
.featured__btn{
width: 195px;
height: 50px;
position: relative;
margin-top: 50px;
display: flex;
flex-direction: column;
.btn{
background-color: var(--main-color);
padding: 20px 60px;
text-align: center;
align-items: center;
justify-content: center;
position: absolute;
z-index: 90;
}
.btn-ef{
background-color: transparent;
clip-path: polygon(25% 0, 100% 0, 100% 75%, 75% 100%, 25% 100%, 0 100%, 0 25%);
position: absolute;
padding: 35px 105px;
text-align: center;
align-items: center;
justify-content: center;
z-index: 99;
left: -10px;
top: -5px;
border: 1px solid var(--main-color);
transition: all 0.3s ease-in-out;
&:hover{
clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%, 41% 100%, 0 100%, 0 0);
}
}
}
<div className="featured__btn">
<div className="btn">LET'S GO</div>
<div className="btn-ef"></div>
</div>

Margin-bottom not working for image elements

The divs inside mini_projects_11 are all attached to each other, but I am providing margin-bottom. I've tried attaching margin to 'a' and also assigning 'a' display:block, but still isn't working.
style.scss
#mini_projects {
background-color: rgba(0,0,0,.85);
grid-column: 1/4;
grid-row: 1/7;
height: 100vh;
width: 100vw;
&1{
display: grid;
height: 100vh;
width: 100vw;
grid-template-columns: 20% 60% 20%;
grid-template-rows: 20% 60% 20%;
background-color: $mainDOrange;
clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
&1{
grid-column: 2/3;
grid-row: 2/3;
overflow-x: hidden;
overflow-y: scroll;
display: grid;
grid-template-columns: 50% 50%;
grid-template-rows: 40% 40%;
grid-auto-rows: 40%;
div{
justify-self: center;
height: 100%;
width: 90%;
margin-bottom:5rem; (NOT WORKING)
text-align: center;
a{
text-decoration: none;
display: block;
img{
width: 100%;
height: 100%;
border-radius: 50%;
}
span{
z-index: 1;
display: block;
color: white;
font-size: 2.5rem;
transform: translate(0rem,5rem);
}
}
}
}
}
}
#mini_projects {
background-color: rgba(0, 0, 0, .85);
grid-column: 0.25;
grid-row: 0.1428571429;
height: 100vh;
width: 100vw;
}
#mini_projects1 {
display: grid;
height: 100vh;
width: 100vw;
grid-template-columns: 20% 60% 20%;
grid-template-rows: 20% 60% 20%;
background-color: orange;
clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}
#mini_projects11 {
grid-column: 0.6666666667;
grid-row: 0.6666666667;
overflow-x: hidden;
overflow-y: scroll;
display: grid;
grid-template-columns: 50% 50%;
grid-template-rows: 40% 40%;
grid-auto-rows: 40%;
}
#mini_projects11 div {
justify-self: center;
height: 100%;
width: 90%;
margin-bottom: 5rem;
/* (NOT WORKING) */
text-align: center;
}
#mini_projects11 div a {
text-decoration: none;
display: block;
}
#mini_projects11 div a img {
width: 100%;
height: 100%;
border-radius: 50%;
}
#mini_projects11 div a span {
z-index: 1;
display: block;
color: white;
font-size: 2.5rem;
transform: translate(0rem, 5rem);
}
<div id="mini_projects">
<div id="mini_projects1">
<div id="mini_projects11">
<div id="omnifood"><span>Omnifood</span><img src="img/omnifood.png" alt=""></div>
<div id="natours"><span>Natours</span><img src="img/natours.png" alt=""></div>
<div id="nexter"><span>Nexter</span><img src="img/nexter.png" alt=""></div>
<div id="trillo"><span>Trillo</span><img src="img/trillo.png" alt=""></div>
</div>
</div>
nevermind, I just fixed it with row-gap in #main_projects_11 .
row-gap:2rem;

Css Rotate 45 causes break in border with gradient

I've noticed that there are slight visible breaks in the CSS border image when rotating. Is there a way to prevent this or another method to achieve the same solution?
.box {
margin: 150px;
width: 250px;
height: 250px;
background: lightGray;
border: 20px solid blue;
border-image: linear-gradient(to right, #3acfd5 0%, #3a4ed5 100%);
border-image-slice: 1;
transform: rotate(45deg);
display: flex;
align-items: center;
justify-content: center;
}
.r45 {
transform: rotate(-45deg);
color: red;
}
<div class="box">
<p class="r45">Hello</p>
</div>
Another method to achieve the same solution is using pseudo:after as shown in the below working example, hope it helps :)
.box {
margin: 150px;
width: 250px;
height: 250px;
background: linear-gradient(to right, #3acfd5 0%, #3a4ed5 100%);
transform: rotate(45deg);
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.box:after {
left: 20px;
right: 20px;
top: 20px;
bottom: 20px;
content: '';
background: lightGray;
position: absolute;
}
.r45 {
transform: rotate(-45deg);
color: red;
position: relative;
z-index: 1;
}
<div class="box">
<p class="r45">Hello</p>
</div>
You can use background and adjust background-clip and you will avoid the strange rendering of border
.box {
margin: 80px;
width: 250px;
height: 250px;
background:
linear-gradient(lightGray,lightGray) padding-box,
linear-gradient(to right, #3acfd5 0%, #3a4ed5 100%) border-box;
border: 20px solid transparent;
display: flex;
align-items: center;
justify-content: center;
transform: rotate(45deg);
}
.r45 {
transform: rotate(-45deg);
color: red;
}
<div class="box">
<p class="r45">Hello</p>
</div>

Creating 4 circles inside each other using css

I'm trying to get 4 circles within in each other (that don't have a background colour, just a border colour) with text inside the last one using CSS.
Example: http://imgur.com/a/5vUKI
Any idea on how this can be done?
Here you go. This should help you get started.
.circle {
border-radius: 50%;
background: transparent;
border: 2px solid red;
width: 500px;
height: 500px;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
}
.c2 {
width: 400px;
height: 400px;
border-color: blue;
}
.c3 {
width: 300px;
height: 300px;
border-color: yellow;
}
.c4 {
width: 200px;
height: 200px;
}
<div class="circles">
<div class="circle c1">
<div class="circle c2">
<div class="circle c3">
<div class="circle c4"></div>
</div>
</div>
</div>
</div>
It's a styling, so don't mess with inner HTML code. CSS Gradients can do this well. it's even animatable
.container {
display: inline-block;
height: 12em;
width: 12em;
padding: 4em;
text-align: center;
background: radial-gradient(circle closest-side,
hsla( 0, 80%, 80%, 0) 0%,
hsla( 0, 80%, 80%, 0) 78%,
hsla( 0, 80%, 80%, 1) 79%,
hsla( 0, 80%, 80%, 1) 82%,
hsla( 0, 80%, 80%, 0) 83%,
hsla(100, 80%, 80%, 0) 87%,
hsla(100, 80%, 80%, 1) 88%,
hsla(100, 80%, 80%, 0) 89%,
hsla(200, 80%, 80%, 0) 92%,
hsla(200, 80%, 80%, 1) 93%,
hsla(200, 80%, 80%, 0) 94%,
hsla(300, 80%, 80%, 0) 97%,
hsla(300, 80%, 80%, 1) 98%,
hsla(300, 80%, 80%, 0) 99%
)
;
}
<div class="container">
My inner text is here
</div>
Simply position all the circles on top of each other.
#outer-circle {
border: 1px solid red;
border-radius: 50%;
height: 500px;
width: 500px;
position: relative;
text-align: center;
}
#inner-circle {
position: absolute;
border: 1px solid red;
border-radius: 50%;
height: 480px;
width: 480px;
top: 50%;
left: 50%;
margin: -240px 0px 0px -240px;
}
#inner-circle2 {
position: absolute;
border: 1px solid red;
border-radius: 50%;
height: 460px;
width: 460px;
top: 50%;
left: 50%;
margin: -230px 0px 0px -230px;
}
#inner-circle3 {
position: absolute;
border: 1px solid red;
border-radius: 50%;
height: 440px;
width: 440px;
top: 50%;
left: 50%;
margin: -220px 0px 0px -220px;
}
#text {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
<div id="outer-circle">
<div id="inner-circle">
<div id="inner-circle2">
<div id="inner-circle3">
<div id="text">Breathe out</div>
</div>
</div>
</div>
</div>
Here's my version.
My logic was divided into 2 steps:
Step One :
The .circle-1 is set as relative to be the container of the child's div.
Step Two
The rest of the div's is set as absolute and has a smallest padding that their father, for their parent aways be bigger than the son.
The align in x-axis is set by the left and right as 0 and margin as 0 auto.
The align in y-axis is set by the top:50% and transform:translateY(-50%).
div{
position: absolute;
border: 3px solid;
border-radius: 50%;
width: 150px;
height: 150px;
left:0;
right:0;
top: 50%;
transform: translateY(-50%);
margin:0 auto;
}
.circle-1{
top: 200px;
padding: 40px;
position: relative;
}
.circle-2{
padding: 30px;
border-color: blue;
}
.circle-3{
padding: 20px;
}
.circle-4{
padding: 10px;
}
<div class="circle-1">
<div class="circle-2">
<div class="circle-3">
<div class="circle-4"></div>
</div>
</div>
</div>
Messing around with this as I procrastinated.
Vertically responsive, basic hover effect.
html, body {
display: flex;
justify-content: center;
height: 100vh;
margin: 0;
padding: 0;
background-color: gray;
}
div {
display: flex;
flex-grow: 1;
background-color: hsla(0, 0%, 0%, 0.0);
border-style: solid;
border-color: white;
border-width: 5px;
border-radius: 100%;
padding: 5px;
overflow: hidden;
transition: all 0.1s linear;
box-sizing: border-box;
}
.ring1 {
height: 100vh;
width: calc(100vh);
}
.ring2 {
border-color: royalblue;
}
.ring4 {
justify-content: center;
align-items: center;
text-align: center;
font-size: 28px;
font-variant: small-caps;
font-weight: bold;
color: royalblue;
background-color: salmon;
}
.ring1:hover, .ring1:hover div {
padding: 3px;
font-size: 32px;
border-width: 3px;
}
<div class="ring1">
<div class="ring2">
<div class="ring3">
<div class="ring4">
Breathe Out
</div>
</div>
</div>
</div>
fiddle
https://jsfiddle.net/Hastig/9v4mLdep/