so i am working on a project for my college and I saw a very cool border style that I would like to replicate in my project, but I am having difficulty getting it right. I am using JavaScript, CSS, and React in this project.
How i want
I tried this:
.input-container {
position: relative;
width: 22vh;
}
.form-control-sub {
width: 100%;
height: 4vh;
padding: 13px 40px 11px 30px;
border-radius: 20px;
border: 5px solid var(--cor-principal);
background-color: transparent;
font-family: Poppins;
font-size: 1.6vh;
font-weight: 800;
text-align: center;
color: var(--cor-secundaria);
position: relative;
}
.form-control-sub.data {
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-radius: 20px;
border-top-style: dashed;
border-image: fill;
}
.data_label {
position: absolute;
top: -10px;
left: 10px;
padding: 0 5px;
color: var(--cor-secundaria);
font-family: Poppins;
font-weight: 800;
z-index: 1;
}
.data_label.cadastro {
left: 59.5%;
}
and i get this:
2
Answers
just keep the top container box has a normal border.like
border: 1px solid black
.then place a box on the left-top side,set it`s position as absolute, also set its background color,make sure the left-top box can cover the boder.I have created a codepen, just refer it for your desired ui.
Hope it helps
Modify it according to your convenience.