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>
Related
This question already has answers here:
Speech bubble with arrow
(3 answers)
how to style chat-bubble in iphone classic style using css only
(4 answers)
CSS speech bubble with rounded arrow
(2 answers)
How to create a curve tail for speech bubble with CSS?
(1 answer)
How to make a box with arrow in CSS?
(7 answers)
Closed 2 years ago.
I want to create chat icon using css only. Here's a sample of it:
I don't want to use bootstrap chat icons because it's hard to customize especially the numbers inside the icon grows.
This is a bit like what you have in your request.
.msg1,
.msg2 {
display: inline-flex;
justify-content: center;
align-items: center;
position: relative;
}
.msg1 {
width: 30px;
height: 25px;
border-radius: 12px;
background-color: #ff6781;
color: white;
}
.msg2 {
width: 35px;
height: 23px;
border-radius: 12px;
border: 2px solid #ff6781;
color: #ff6781;
}
.msg1 p,
.msg2 p {
font-size: 14px;
}
.msg1:after {
content: '';
position: absolute;
background-color: #ff6781;
top: 89%;
left: 35%;
width: 3px;
height: 7px;
transform: rotate(-45deg);
}
.msg1:before {
content: '';
position: absolute;
background-color: #ff6781;
top: 89%;
left: 48%;
width: 3px;
height: 7px;
transform: rotate(45deg);
}
.msg2:after {
content: '';
position: absolute;
background-color: #ff6781;
top: 100%;
left: 35%;
width: 3px;
height: 6px;
transform: rotate(-45deg);
}
.msg2:before {
content: '';
position: absolute;
background-color: #ff6781;
top: 100%;
left: 40%;
width: 3px;
height: 6px;
transform: rotate(45deg);
}
<div class="msg1"><p>4</p></div>
<div class="msg2"><p>11</p></div>
second solution:
.msg1,
.msg2 {
display: inline-flex;
justify-content: center;
align-items: center;
position: relative;
}
.msg1 {
width: 30px;
height: 25px;
border-radius: 12px;
background-color: #ff6781;
color: white;
}
.msg2 {
width: 35px;
height: 23px;
border-radius: 12px;
border: 2px solid #ff6781;
color: #ff6781;
}
.msg1 p,
.msg2 p {
font-size: 14px;
}
.msg1:after {
content: '';
position: absolute;
top: 100%;
left: 33%;
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 10px solid #ff6781;
}
.msg2:after {
content: '';
position: absolute;
top: 100%;
left: 25%;
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 10px solid #ff6781;
}
<div class="msg1"><p>4</p></div>
<div class="msg2"><p>11</p></div>
.chat-icon {
color: #161616;
position: relative;
height: 30px;
width: 60px;
font-size: 1.4rem;
}
.balloon {
display: flex;
position: absolute;
justify-content: center;
border: 2px solid red;
align-items: center;
background-color: white;
border-radius: 2rem;
height: 20px;
width: 100%;
z-index: 2;
}
.stick {
width: 20px;
position: absolute;
height: 8px;
background-color: red;
margin-left: 0.5rem;
transform: rotate(45deg);
top: 15px;
}
<div class="chat-icon">
<div class="balloon">10</div>
<div class="stick"></div>
</div>
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 2 years ago.
Improve this question
I would like to create a transition effect on hover that is similar to the large "start voting" button on this website but, while I am familiar with css transition effects, I dont know how to create that one in particular. Thank you for taking the time to read this.
You can use a background-size transition:
a {
position: relative;
display: inline-block;
padding: 12px 80px;
border: 2px solid #BDAA67;
color: white;
font-size: 30px;
text-decoration: none;
background-color: black;
background-image: linear-gradient(#BDAA67, #BDAA67);
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: 0% 0%;
transition: background-size .3s, color .3s;
}
a:hover {
background-size: 100% 100%;
color: #000;
}
<a href="#" class="button">
CLICK ME!
</a>
{content: "";
background-color: #bdaa67;
height: 0%;
width: 50%;
position: absolute;
left: 25%;
transition: all .15s ease-in-out;
top: 48%;
z-index: -1;}
Try this
Add the following lines of code to your HTML,
<button class="custom-btn">Start now</button>
Add the following lines of code to your custom.css. This will give the exact style on hover for the button. You can minimise the code if you are willing to use bootstrap. Here we have custom styled the button from scratch.
.custom-btn {
font-size: 25px;
padding: 32px 105px;
text-shadow: none;
border: 2px solid #000;
background: #000;
color: #fff;
font-weight: bold;
text-transform: uppercase;
position: relative;
z-index: 1;
transition: all .33s ease-in-out;
}
.custom-btn:hover {
border: 2px solid #bdaa67;
color: #000;
}
.custom-btn::before {
content: "";
background-color: #bdaa67;
height: 0%;
width: 50%;
position: absolute;
left: 25%;
transition: all .15s ease-in-out;
top: 48%;
z-index: -1;
}
.custom-btn:hover::before {
height: 100%;
width: 100%;
left: 0;
top: 0;
}
<body>
<button> START VOTING </button>
</body>
body {
margin: 0;
padding: 0;
height: 100vh;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background: red;
}
button {
position: absolute;
padding: 40px 120px;
font-weight: bold;
border: 0;
color: #fff;
font-size: 2em;
text-transform: uppercase;
background: #000;
z-index: 1;
}
button::before {
content:"";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: #bdaa67;
transform: scale(0);
transition: 0.3s;
z-index: -1;
}
button:hover:before {
transform: scale(1);
}
button:hover {
border: 3px solid #bdaa67;
color: #000;
}
I'm trying to make some arrows like the following
arrows
I am using Sass and Bootstrap4 and I want to make them by drawing them with css3
I've tried this, but I don't know how to achieve it:
.line1 p{
background-color: red;
width: 80px;
height: 80px;
text-align: center;
align-items: center;
border-radius: 50%;
color: #fff;
font-size: 2rem;
}
.line1 p::before{
content:'';
display: block;
color: blue;
width: 300px;
height: 10px;
position: absolute;
border: 5px solid red;
margin: 30px 10px 0;
z-index: -1;
border-radius: 0 50px 50px 0;
background-color: red;
}
.line1 p::after{
content:'';
display: block;
color: blue;
width: 10px;
height: 200px;
position: absolute;
border: 5px solid red;
margin-left: 20px;
z-index: -1;
background-color: red;
}
<div class="col-md-3 align-items-center mr-0">
<div class="line1 my-auto">
<p class="d-block my-auto">1</p>
</div>
</div>
I come from the future and you managed to do it like this:
.line-container{
border-bottom: 5px solid red;
border-right: 5px dashed red;
}
.line-container::before{
content:"";
// display:block;
position: absolute;
height: 20px;
width:20px;
border-radius:50%;
background: red;
bottom:-7px;
left:0;
}
.line-container::after{
content:"2";
position:absolute;
width:55px;
height:55px;
border-radius:50%;
background: red;
bottom:-25px;
right:-7px;
font-size:2rem;
font-weight:700;
color:#fff;
text-align:center;
}
.line-container p::before{
content:"➤";
position:absolute;
font-size:32px;
color:red;
right:2.6px;
top:-30px;
transform: rotate(270deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-8 mt-5">
<div class="line-container px-md-5 pt-5">
<p class="mt-5" >Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta minus </p>
</div>
</div>
You only need to use the 'lines' of the rectangles of the containers, they already exist so you only need to put color
I was able to find the initial css for a triangle here. Basically you want to make two borders of a div transparent and give them a certain width so it appears to pinch the div into a triangle. I also added the ball which was pretty straightforward aside from positioning.
You may want to make further adjustments to fit your needs but this should get you started :)
.line1 p{
background-color: red;
width: 80px;
height: 80px;
text-align: center;
align-items: center;
border-radius: 50%;
color: #fff;
font-size: 2rem;
}
.line1 p::before{
content:'';
display: block;
color: blue;
width: 300px;
height: 10px;
position: absolute;
border: 5px solid red;
margin: 30px 10px 0;
z-index: -1;
border-radius: 0 50px 50px 0;
background-color: red;
}
.line1 p::after{
content:'';
display: block;
color: blue;
width: 10px;
height: 200px;
position: absolute;
border: 5px solid red;
margin-left: 20px;
z-index: -1;
background-color: red;
}
.arrow1{
position: absolute;
transform: rotate(180deg);
left: 3px;
top: 225px;
width: 0;
height: 0;
border-right: 28px solid transparent;
border-bottom: 60px solid red;
border-left: 28px solid transparent;
}
.ball1{
position: absolute;
left: 300px;
top: 15px;
background-color: red;
border-radius: 50%;
height: 50px;
width: 50px;
}
<div class="col-md-3 align-items-center mr-0" style="position: relative;">
<div class="line1 my-auto">
<p class="d-block my-auto">1</p>
<div class='arrow1'></div>
<div class='ball1'></div>
</div>
</div>
Well, I'll give you a quick PoC you could easily expand on so its use could be defined for the instance with pre-made templates but if you want all other directions and stuff you'll have to do the extra creative work and fill in the blanks on your own but this might help get you started. Cheers!
.magic-arrows {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: var(--arrow-circle-height);
width: var(--arrow-circle-width);
background-color: var(--arrow-color);
border-radius: 50%;
overflow: visible;
}
.magic-arrows:before, .magic-arrows:after {
content: '';
display: block;
position: absolute;
color: var(--arrow-color);
border: var(--arrow-color) var(--arrow-dash-size) dashed;
overflow: visible;
z-index: -1;
}
.magic-arrows:before {
height: 0;
width: calc( var(--arrow-circle-width) + var(--arrow-width) );
left: var(--arrow-circle-width);
top: 50%;
transform: translateY(-50%);
}
.magic-arrows:after {
width: 0;
height: calc( var(--arrow-circle-width) + var(--arrow-width) );
top: var(--arrow-circle-width);
left: 50%;
transform: translateX(-50%);
}
.magic-arrows .arrow-right, .magic-arrows .dot-down {
position: absolute;
font-size: var(--arrow-size);
color: var(--arrow-color);
}
.magic-arrows .arrow-right {
top: 50%;
left: calc(var(--arrow-circle-width) + var(--arrow-width) + var(--arrow-size) + 1rem);
transform: translateY(-55%);
}
.magic-arrows .dot-down {
position: absolute;
left: 50%;
top: calc(var(--arrow-circle-width) + var(--arrow-width) + var(--arrow-size) + 1rem);
transform: translateX(-55%) rotate(90deg);
}
<div class="magic-arrows"
style="--arrow-color: red;
--arrow-circle-height: 3rem;
--arrow-circle-width: 3rem;
--arrow-width: 10rem;
--arrow-dash-size: 5px;
--arrow-size: 2rem;">
<span>3</span>
<div class="arrow-right">➤</div>
<div class="dot-down">◉</div>
</div>
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>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am looking for a library which has some custom breadcrumbs as the following:
Any idea what I could use to have a result looking as my image (ish).
You can create fast in css like this:
No need library, just adapt my snippet for you with your styles and icons
$('.breadcrumb__item').click(function(){
$('.breadcrumb__item').removeClass('active');
$(this).addClass('active');
});
.breadcrumb{
width: 80%;
margin: 20px auto;
padding: 0;
position: relative;
list-style: none;
display: flex;
justify-content: space-between;
overflow-x: hidden;
}
.breadcrumb::after{
position: absolute;
height: 2px;
width: 100%;
background: blue;
left: 0;
top: 50%;
transform: translateY(-50%);
content:'';
}
.breadcrumb__item{
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
border: 2px solid blue;
border-radius: 50%;
display: block;
background: grey;
position: relative;
z-index: 1;
cursor: pointer;
}
.breadcrumb__item span{
display: block;
height: 100%;
width: 100%;
position: relative;
z-index: 3;
background: blue;
border-radius: 50%;
}
.breadcrumb__item.active span{
background: #fff;
}
.breadcrumb__item.active ~ .breadcrumb__item{
border-color: grey;
}
.breadcrumb__item.active ~ .breadcrumb__item span{
display: none;
}
.breadcrumb__item.active::after{
position: absolute;
height: 2px;
width: 999999%;
background: grey;
left: 0;
top: 50%;
transform: translateY(-50%);
content:'';
z-index: 2;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="breadcrumb">
<li class="breadcrumb__item">
<span>1</span>
</li>
<li class="breadcrumb__item active">
<span>2</span>
</li>
<li class="breadcrumb__item">
<span>3</span>
</li>
<li class="breadcrumb__item">
<span>4</span>
</li>
</ul>