Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I need to replicate this.
What is the best way to add a cirle like this image with css?
thanks
Here's a quick example, I think you can do it a bit better if you take time ;).
if you want a full circle just make the (border-radius : 50%) for all corners instead of only top.
cheers
.circle{
height: 50px;
width: 100px;
border-top-left-radius:90px;
border-top-right-radius:90px;
background-color: green;
color:white;
margin: 0 auto;
text-align: center;
line-height: 50px;
}
.square{
width:500px;
height: 300px;
background-color: white;
border: 1px solid black;
margin: 0 auto;
}
<div class="circle">1/12</div>
<div class="square"></div>
I've added your numbered tab into the :before tab, so that it will always be attached to your div.
.square {
position: relative;
width: 80%;
height: 300px;
background-color: white;
margin: 60px auto;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.square:before {
content:'1/12';
position: absolute;
top: -35px;
height: 65px;
width: 65px;
border-radius: 50%;
z-index: -1;
transform: translate(-50%);
left: 50%;
background: #4ED3CE;
color: #fff;
display: flex;
justify-content: center;
padding: 10px;
}
<div class="square">
</div>
You can achieve half circle with following code, then you can customize it yourself
div {
background: #9e978e;
display: inline-block;
margin: 0 1em 1em 0;
}
.top,
.bottom {
height: 45px;
width: 90px;
}
.right,
.left {
height: 90px;
width: 45px;
}
.top {
border-top-left-radius: 90px;
border-top-right-radius: 90px;
}
.right {
border-bottom-right-radius: 90px;
border-top-right-radius: 90px;
}
.bottom {
border-bottom-left-radius: 90px;
border-bottom-right-radius: 90px;
}
.left {
border-bottom-left-radius: 90px;
border-top-left-radius: 90px;
}
.rotate {
animation: 1s linear infinite rotate;
position: relative;
top: $size * -1;
transform-origin: 50% 100%;
}
#keyframes rotate {
from {
transform: rotate(0deg)
}
to {
transform: rotate(360deg)
}
}
<div class="top"></div>
<div class="right"></div>
<div class="bottom"></div>
<div class="left"></div>
<div class="rotate top"></div>
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I wonder that if someone could provide or suggest me how to make a css style better approach than mine?
This is what expected shape :
What is done so far :
.labelModel {
display: block;
position: absolute;
z-index: 100;
border: 2px solid #ccc;
background-color: #404040;
cursor: pointer;
border-radius: 10px;
padding: 10px;
width: 12rem;
height: 12rem;
color: white;
margin-left: 100px;
}
.line-infocard {
position: relative;
top: 200px;
width: 150px;
height: 5px;
z-index: 99;
border: 2px solid #ccc;
background-color: #404040;
transform: rotate(-45deg);
}
<div>
<div class="line-infocard"></div>
<div class="labelModel">info :</div>
</div>
.labelModel {
display: block;
position: absolute;
z-index: 100;
border: 2px solid #ccc;
cursor: pointer;
width: 12rem;
height: 12rem;
margin-left: 100px;
}
.labelBox{
background-color: #404040;
width:89%;
height:89%;
padding: 10px;
transform: rotate(1deg);
color:orange;
}
.line-infocard {
position: relative;
top: 200px;
right:50px;
width: 150px;
height: 2px;
z-index: 99;
background-color: #404040;
transform: rotate(-60deg);
}
.line-infocard::after{
content:'';
width:2px;
height:40px;
background-color:black;
top: 88%;
right: -11px;
position: absolute;
transform: rotate(
-28deg);
}
<div>
<div class="line-infocard"></div>
<div class="labelModel">
<div class="labelBox">
info :
</div>
</div>
</div>
I am making a progress bar with a checkmark after 30% of the progress bar with flexbox.
I divided the bar into 3 parts, one with an orange background, then the checkmark then the red background.
The problem is that the dot (checkmark) doesn't come exactly after 30%, I need to align it in the center between the orange and red background.
.progress-container {
display: flex;
background: gray;
height: 20px;
width: 500px;
border-radius: 20px;
position: relative;
}
.threshold {
background: orange;
width: 30%;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.dot {
position: absolute;
left: 30%;
margin-top: -5px;
width: 24px;
height: 24px;
text-align: center;
border: 4px solid green;
background: #f8f8f8;
border-radius: 50%;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.dot:after {
content: "✔";
color: green;
font-weight: bold;
font-size: 18px;
}
.completed {
flex: 1;
background: red;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
<div class="progress-container">
<div class="threshold">
</div>
<div class="dot">
</div>
<div class="completed">
</div>
</div>
you need to push your div.dot 50% to the left to make the starting point of div as a center of a checkmark.
transform: translateX(-50%)
.progress-container {
display: flex;
background: gray;
height: 20px;
width: 500px;
border-radius: 20px;
position: relative;
}
.threshold {
background: orange;
width: 30%;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.dot {
position: absolute;
left: 30%;
margin-top: -5px;
width: 24px;
height: 24px;
text-align: center;
border: 4px solid green;
background: #f8f8f8;
border-radius: 50%;
transform: translateX(-50%);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.dot:after {
content: "✔";
color: green;
font-weight: bold;
font-size: 18px;
}
.completed {
flex: 1;
background: red;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
<div class="progress-container">
<div class="threshold">
</div>
<div class="dot">
</div>
<div class="completed">
</div>
</div>
Use transform: translate(-50%).
Essentially, the problem is that (because you use the 'left' property), your .dot div is being positioned by its left edge, while you want it to be positioned according to its center. One way to solve this is to simply shift your div to the left by half its width, thereby placing its center where its left edge used to be. This can be done by passing '-50%' to translate, shifting the element to the left by 50% of the element's width.
Your example, modified:
.progress-container {
display: flex;
background: gray;
height: 20px;
width: 500px;
border-radius: 20px;
position: relative;
}
.threshold {
background: orange;
width: 30%;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.dot {
transform: translate(-50%); /* Add this to offset the checkmark */
position: absolute;
left: 30%;
margin-top: -5px;
width: 24px;
height: 24px;
text-align: center;
border: 4px solid green;
background: #f8f8f8;
border-radius: 50%;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.dot:after {
content: "✔";
color: green;
font-weight: bold;
font-size: 18px;
}
.completed {
flex: 1;
background: red;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
<div class="progress-container">
<div class="threshold">
</div>
<div class="dot">
</div>
<div class="completed">
</div>
</div>
I am building a webpage with cards arranged in a grid.
However, I would like my cards to have a unique shape, rather than just being rectangles. The shape I would like them to be is the shape of a manilla folder (pictured below)
Is there any relatively simply way to make a div with this shape?
Here is a start using only html and css:
body {
padding: 50px;
}
div {
position: relative;
z-index: 1;
white-space: nowrap;
}
div .slant {
position: relative;
display: inline-block;
color: inherit;
text-decoration: none;
margin: 0 -14px -4px;
width: 40px;
}
div .slant::before,
main {
border: 0.2em solid #000;
background: #000;
}
div .slant::before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0.5em;
left: 0;
z-index: -1;
border-bottom: none;
border-radius: 5px 5px 0 0;
background: #000;
transform: perspective(5px) rotateX(2deg);
transform-origin: bottom;
}
div.left .slant {
padding: 1.5em 2em 1em 1em;
}
div.left .slant::before {
transform-origin: bottom left;
}
main {
display: block;
margin: -8px 0 30px -14px;
padding: 1em;
border-radius: 0 5px 5px 5px;
width: 200px;
height: 300px;
}
<div class="left">
<div class="slant"></div>
</div>
<main>
</main>
It took me about 10 minutes just to do that, so if you have the motivation to improve it, feel free to do so. It is possible to do it with divs and positioning with CSS. It's just a matter of playing with z-index and shapes, but unless you just wan't to impress yourself for achieving it, the easiest way is to create a background image and move your html content over it.
I am not the best front-end programmer either so don't be arshe! I'm sure someone else could improve it even better with outline borders and stuff.
div#panel {
position: absolute;
border: 3px solid black;
border-radius: 10px;
width: 200px;
height: 200px;
background-color: white;
top: 50%;
left: 50%;
z-index: 3;
transform: translate(-50%, -50%);
}
div#box {
position: absolute;
border: 3px solid red;
z-index: 0;
border-radius: 10px;
width: 200px;
height: 200px;
top: 48.5%;
left: 50%;
z-index: ;
transform: translate(-50%, -50%);
}
div#box2 {
position: absolute;
border: 3px solid red;
border-radius: 10px;
width: 80px;
height: 200px;
background-color: white;
top: 47%;
left: 46.9%;
z-index: 1;
transform: translate(-50%, -50%);
}
<div id="panel"></div>
<div id="box">
<p style="padding-left: 5px;"> Some text here</p>
</div>
<div id="box2"></div>
You can use this shape as the background-image of the card. Remove the card default property like background-color, box-shadow...
HTML:
<div class="main-class">
<div class="card">
.....
</div>
</div>
CSS:
.main-class .card{
background-image: url("path");
background-repeat: no-repeat;
background-size: cover;
background-color: transparent;
box-shadow: none;
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm having a problem to make s curve in my footer
anyone can help me to make a footer like this:
according to css skew element and get inner rounded border top this could be a solution for you:
.footer {
height: 100px;
position: relative;
overflow: hidden;
background-color: green;
}
.content {
position: absolute;
top: 40%;
left: 5px;
}
.footer:before,
.footer:after {
content: "";
vertical-align: top;
display: inline-block;
transform-origin: top right;
transform: skew(-40deg);
}
.footer:before {
height: 100%;
width: 50%;
border-radius: 0 0 40px 0;
background: lightgrey;
}
.footer:after {
height: 40px;
width: 40px;
margin-left: -1px;
background: radial-gradient(circle at bottom right, transparent 68%, lightgrey 70%);
}
<div class="footer"><div class="content">text goes here</div></div>
Try this
:root {
--bg-color: #12633a;
--fg-color: #eaeaea;
--radius: 80px;
}
.container {
display: flex;
}
.left {
background: var(--fg-color);
height: 250px;
flex-grow: 1;
}
.right {
background: var(--bg-color);
height: 250px;
flex-grow: 1;
}
.clip {
width: 300px;
overflow: hidden;
}
.d {
display: flex;
background: var(--fg-color);
justify-content:center;
width: 500px;
margin-left:-100px;
}
.d1 {
background: var(--fg-color);
height: 250px;
width: 250px;
border-bottom-right-radius: calc(var(--radius));
transform: skewX(-30deg);
}
.d2 {
background: var(--bg-color);
}
.d3 {
background: var(--bg-color);
height: 250px;
width: 250px;
border-top-left-radius: var(--radius);
transform: skewX(-30deg);
}
<div class="container">
<div class="left"></div>
<div class="clip">
<div class="d">
<div class="d2"><div class="d1"></div></div>
<div class="d3"></div>
</div>
</div>
<div class="right"></div>
</div>
How can I achieve rounded hover effect like in the attached image (at the right bottom pic)
Here is the fiddle link
Here is the relevant css:
.box_details {
float:left;
width:200px;
height:200px;
margin-right:35px;
background-color:#fff;
border-radius:3px;
box-shadow: 0px 6px 19px 16px rgba(239,242,245,1);
}
.box_details:hover {
background-color:#f4f6f8;
color:#939bc5;
}
You can make a circle that has a bigger width than its parent element and center it. Check the code snippet for a demonstration of this.
.box_details {
float: left;
width: 200px;
height: 200px;
margin-right: 35px;
background-color: #fff;
display: block;
position: relative;
border-radius: 3px;
box-shadow: 0px 6px 19px 16px rgba(239, 242, 245, 1);
overflow: hidden;
}
.box_details:hover .circle {
margin-top: 140px;
transition-duration: 0.4s;
}
p {
text-align: center;
}
.circle {
position: absolute;
width: 200%;
height: 100px;
left: 0;
right: 0;
margin: 0 auto;
background: lightgrey;
border-radius: 50%;
margin-left: -50%;
margin-top: 250px;
transition-duration: 0.4s;
}
<div class="box_details">
<div class="circle">
<p>Hi!</p>
</div>
</div>