Buttons design link down below
I need this design tried via before after but need the arrow softer
used skew and all.
also found references but that didn't work out, it seems very easy and similar design but couldn't find similar ones on the internet via examples.
https://i.stack.imgur.com/BCRNb.png
#import url('https://fonts.googleapis.com/css2?family=Montserrat:wght#100&family=Poppins:wght#300&display=swap');
body {
background: #fff;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Montserrat', sans-serif;
font-family: 'Poppins', sans-serif;
}
/* ------------------------- Separate line ------------------------- */
:root {
--breadcrumb-theme-1: #398AB9;
--breadcrumb-theme-2: #DFDFDE;
--breadcrumb-theme-3: #1C658C;
--breadcrumb-theme-4: #FFF;
}
a{
font-size: medium;
}
.breadcrumb {
text-align: center;
display: inline-block;
box-shadow: 0 2px 5px rgba(0,0,0,0.25);
overflow: hidden;
border-radius: 5px;
counter-reset: flag;
}
.breadcrumb__step {
text-decoration: none;
outline: none;
display: block;
float: left;
font-size: 14px;
font-weight:bold;
line-height: 36px;
padding: 0 10px 0 30px;
position: relative;
background: var(--breadcrumb-theme-2);
color: var(--breadcrumb-theme-1);
transition: background 0.5s;
}
.breadcrumb__step:first-child {
border-radius: 5px 0 0 5px;
}
.breadcrumb__step:first-child::before {
left: 14px;
}
.breadcrumb__step:last-child {
border-radius: 0 5px 5px 0;
padding-right: 20px;
}
.breadcrumb__step:last-child::after {
content: none;
}
.breadcrumb__step::after {
content: '';
position: absolute;
top: 0;
right: -18px;
width: 36px;
height: 36px;
transform: scale(0.707) rotate(45deg);
z-index: 1;
border-radius: 0 5px 0 50px;
background: var(--breadcrumb-theme-2);
transition: background 0.5s;
box-shadow: 2px -2px 0 2px var(--breadcrumb-theme-4);
}
.breadcrumb__step--active {
color: var(--breadcrumb-theme-2);
background: var(--breadcrumb-theme-1);
}
.breadcrumb__step--active::before {
color: var(--breadcrumb-theme-1);
}
.breadcrumb__step--active::after {
background: var(--breadcrumb-theme-1);
}
.breadcrumb__step:hover {
color: var(--breadcrumb-theme-2);
background: var(--breadcrumb-theme-3);
}
.breadcrumb__step:hover::before {
color: var(--breadcrumb-theme-1);
}
.breadcrumb__step:hover::after {
color: var(--breadcrumb-theme-1);
background: var(--breadcrumb-theme-3);
}
<div class="breadcrumb">
<a class="breadcrumb__step breadcrumb__step--active" href="#">Choose product</a>
<a class="breadcrumb__step" href="#">Place order</a>
<a class="breadcrumb__step" href="#">Shiping</a>
<a class="breadcrumb__step" href="#">Booking</a>
<a class="breadcrumb__step" href="#">Complete</a>
</div>
Related
This question already has answers here:
Circle with two borders
(4 answers)
Closed 3 months ago.
I have a CSS style for a button. I don’t know how to do it. I think it’s a bit too complicated and it’s not easy to make responsive adjustments. I would like to ask everyone how to write a button like this in CSS? thanks
.save_coin {
display: inline-block;
position: relative;
z-index: 3;
}
.save_coin::after {
content: "";
display: inline-block;
position: absolute;
background: #222;
border-radius: 32px;
padding: 26px 101px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
#media (max-width: 768px) {
.save_coin::after {
border-radius: 38px;
padding: 38px 102px;
}
}
.save_coin span {
display: inline-block;
font-weight: 500;
text-align: center;
background: #222;
color: #fff;
padding: 12px;
border-radius: 32px;
position: relative;
z-index: 2;
border: 1px solid #fff;
width: 192px;
}
#media (max-width: 768px) {
.save_coin span {
width: auto;
font-size: 24px;
font-weight: 700;
padding: 15px 46px;
}
}
.save_coin:hover span {
color: #222;
background-color: #fff;
}
<span>save</span>
I think you can use outline attribute, work pretty good imo.
button {
padding: 10px 30px;
border-radius: 50px;
border: 2px solid white;
background-color: black;
color: white;
outline: 2px solid black;
}
button:hover {
background-color: white;
color: black;
}
<button>save</button>
You could try the box-shadow CSS property:
button {
cursor: pointer;
outline: none;
font-size: 30px;
/* 👇 outer line */
border: 5px solid black;
/* some very large number, to get a pill effect */
border-radius: 1024px;
padding: 30px 60px 30px 60px;
background: black;
color: white;
/* 👇 inner white line */
box-shadow: inset 0 0 0 3px white;
/* custom transition */
transition: 0.3s ease;
}
/* ignore this if you just want button design */
button:hover {
background: white;
color: black;
}
<button type="button">立即儲值</button>
I'm unable to get the hover background color timing to sync with :before. How can I fix this issue?
When you hover over the button, you will notice the transition of the background color is not in sync.
JSFIDDLE DEMO: https://jsfiddle.net/7c25wmuz/
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
}
.btn-donate:before {
content: '';
position: absolute;
top: 0;
left: 0;
border-top: 30px solid white;
border-right: 20px solid #053a86;
width: 0;
}
.btn-donate:hover::before {
border-right: 20px solid #45aff6;
}
Donate
Clip path is the solution you need for something like this.
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
transition: .5s all ease;
}
Donate
You can just add a background transition to .btn-donate and border transition to .btn-donate:before like so:
(added padding bottom to see things)
body {
margin-top: 15px;
}
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
padding-bottom: 1rem;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
transition: .3s ease background;
}
.btn-donate:before {
content: '';
position: absolute;
top: 0;
left: 0;
border-top: 30px solid white;
border-right: 20px solid #053a86;
width: 0;
transition: .3s ease border;
}
.btn-donate:hover::before {
border-right: 20px solid #45aff6;
}
Donate
It seems you runned into conflict with browser default styles. You can see default styles in your Developer tools (F12) you just need to enable it. Go to developer tools settings and check "Show browser styles".
This issue can be simply fixed by overriding default styles with your own.
body {
margin-top: 15px;
}
.btn {
transition: unset; /* override, this is all you need */
display: block;
height: 30px;
}
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
}
.btn-donate:before {
content: '';
position: absolute;
top: 0;
left: 0;
border-top: 30px solid white;
border-right: 20px solid #053a86;
width: 0;
}
.btn-donate:hover::before {
border-right: 20px solid #45aff6;
}
Donate
I have been trying for hours to style my navigation bar(which is horizontal at the top of the screen) so that my logo will show at left , menu on the center and the username with the logout button at right(all of them horizontally).I tried float ,position display, but nothing seems to work as i want.Instead the result is all the elements(logo,menu,username,logout button) to appear in the center.Any help would be appreciated.
HTML code
<header>
<div class="page">
<nav class="page__menu page__custom-settings menu">
<div class="logo">
<img src="images/logo.png">
</div>
<ul class="menu__list r-list">
<li class="menu__group">Main</li>
<li class="menu__group">Songs</li>
<li class="menu__group">Ratings</li>
</ul>
<section id="login">
Logout
<h1>User: <?php echo $user_data['user_name']; ?></h1>
</section>
</nav>
</header>
CSS code
.r-link{
display: var(--rLinkDisplay, inline-flex) !important;
}
.r-link[href]{
color: var(--rLinkColor) !important;
text-decoration: var(--rLinkTextDecoration, none) !important;
}
.r-list{
padding-right: var(--rListPaddingRight, 0) !important;
margin-top: var(--rListMarginTop, 0) !important;
margin-bottom: var(--rListMarginBottom, 0) !important;
margin-left: var(--rListMarginLeft, 0) !important;
list-style: var(--rListListStyle, none) !important;
}
.menu{
--rLinkColor: var(--menuLinkColor, currentColor);
display: flex;
justify-content: center;
}
.menu__link{
display: var(--menuLinkDisplay, block);
}
.menu__link:focus{
outline: var(--menuLinkOutlineWidth, 2px) solid var(--menuLinkOutlineColor, currentColor);
outline-offset: var(--menuLinkOutlineOffset);
}
.menu__link:hover{
--rLinkColor: #e8491d; ;
}
.menu{
background-color: var(--menuBackgroundColor, #f0f0f0);
box-shadow: var(--menuBoxShadow, 0 1px 3px 0 rgba(0, 0, 0, .12), 0 1px 2px 0 rgba(0, 0, 0, .24));
}
.menu__list{
display : flex;
}
.page__menu img{
float: left;
position: relative;
margin: 10px 15px 15px 10px;
display: block;
width: 450px;
max-width:100% ;
height: auto;
margin: auto;
}
.menu__link{
padding: var(--menuLinkPadding, 1.5rem 2.5rem);
font-weight: 700;
text-transform: uppercase;
}
.text-underlined{
position: relative;
overflow: hidden;
will-change: color;
transition: color .25s ease-out;
}
.text-underlined::before,
.text-underlined::after{
content: "";
width: 0;
height: 3px;
background-color: var(--textUnderlinedLineColor, currentColor);
will-change: width;
transition: width .1s ease-out;
position: absolute;
bottom: 0;
}
.text-underlined::before{
left: 50%;
transform: translateX(-50%);
}
.text-underlined::after{
right: 50%;
transform: translateX(50%);
}
.text-underlined:hover::before,
.text-underlined:hover::after{
width: 100%;
transition-duration: .2s;
}
.page__custom-settings{
--menuBackgroundColor: #255785;
--menuLinkColor: #fff;
--menuLinkColorUnactive: #241c69;
--menuLinkOutlineOffset: -.5rem;
}
.button {
background-color: #e8491d;
color: white;
padding: 10px 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 7px 7px;
transition-duration: 0.4s;
cursor: pointer;
float : right;
}
.button:hover {
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);
}
h1 {
text-align: right;
font-size: 14px;
font-weight: bold;
font-family: "Times New Roman", Times, serif;
color: white;
padding: 20px;
}
Here is the result what I fixed, please check and let me know.
You need to change justify-content: space-between instead center to the menu and add align-items: center and align-items: center to the #login.
Added the fixed css code.
Hope it is helpful~
.r-link {
display: var(--rLinkDisplay, inline-flex) !important;
}
.r-link[href] {
color: var(--rLinkColor) !important;
text-decoration: var(--rLinkTextDecoration, none) !important;
}
.r-list {
padding-right: var(--rListPaddingRight, 0) !important;
margin-top: var(--rListMarginTop, 0) !important;
margin-bottom: var(--rListMarginBottom, 0) !important;
margin-left: var(--rListMarginLeft, 0) !important;
list-style: var(--rListListStyle, none) !important;
}
.menu {
--rLinkColor: var(--menuLinkColor, currentColor);
display: flex;
justify-content: space-between;
align-items: center;
}
.menu__link {
display: var(--menuLinkDisplay, block);
}
.menu__link:focus {
outline: var(--menuLinkOutlineWidth, 2px) solid var(--menuLinkOutlineColor, currentColor);
outline-offset: var(--menuLinkOutlineOffset);
}
.menu__link:hover {
--rLinkColor: #e8491d;
}
.menu {
background-color: var(--menuBackgroundColor, #f0f0f0);
box-shadow: var(--menuBoxShadow, 0 1px 3px 0 rgba(0, 0, 0, .12), 0 1px 2px 0 rgba(0, 0, 0, .24));
}
.menu__list {
display: flex;
padding-left: 0;
}
.page__menu img {
float: left;
position: relative;
margin: 10px 15px 15px 10px;
display: block;
width: 450px;
max-width: 100%;
height: auto;
margin: auto;
}
#login {
display: flex;
align-items: center;
}
.menu__link {
padding: var(--menuLinkPadding, 1.5rem 2.5rem);
font-weight: 700;
text-transform: uppercase;
}
.text-underlined {
position: relative;
overflow: hidden;
will-change: color;
transition: color .25s ease-out;
}
.text-underlined::before,
.text-underlined::after {
content: "";
width: 0;
height: 3px;
background-color: var(--textUnderlinedLineColor, currentColor);
will-change: width;
transition: width .1s ease-out;
position: absolute;
bottom: 0;
}
.text-underlined::before {
left: 50%;
transform: translateX(-50%);
}
.text-underlined::after {
right: 50%;
transform: translateX(50%);
}
.text-underlined:hover::before,
.text-underlined:hover::after {
width: 100%;
transition-duration: .2s;
}
.page__custom-settings {
--menuBackgroundColor: #255785;
--menuLinkColor: #fff;
--menuLinkColorUnactive: #241c69;
--menuLinkOutlineOffset: -.5rem;
}
.button {
background-color: #e8491d;
color: white;
padding: 10px 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 7px 7px;
transition-duration: 0.4s;
cursor: pointer;
float: right;
}
.button:hover {
box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19);
}
h1 {
text-align: right;
font-size: 14px;
font-weight: bold;
font-family: "Times New Roman", Times, serif;
color: white;
padding: 20px;
}
I have boxes with some content but not all text is displayed. On click I toggle all the text but the problem is I don't want the bottom element to move, instead I want the toggled div to be on top of the bottom element. Would anyone help with ideas how to do this? Thank you.
Ps. Also, for some reason the transition/animation doesn't work.
Here is a link to codepen: https://codepen.io/christmastrex/pen/gOwGvap and here is my code:
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">“It’s not about weight it’s about how<br> your body changes”</p>
</div>
<div class="card__toggle">
<p>Doing resistance training and cardio combined and I have not lost one single ounce on the scale….I was feeling horribly frustrated being it has been a month so I decided to do a progress sequence and wth look at me now!! It’s not about weight, it’s about how your body changes when you eat right and exercise! Yay!!”</p>
</div>
</div>
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">“It’s not about weight it’s about how<br> your body changes”</p>
</div>
<div class="card__toggle">
<p>Doing resistance training and cardio combined and I have not lost one single ounce on the scale….I was feeling horribly frustrated being it has been a month so I decided to do a progress sequence and wth look at me now!! It’s not about weight, it’s about how your body changes when you eat right and exercise! Yay!!”</p>
</div>
</div>
------------------------------------------------------------
.card {
background-color: #fff;
max-width: 490px;
padding: 20px;
margin-bottom: 30px;
border-radius: 5px;
position: relative;
box-sizing: border-box;
box-shadow: 0 3px 30px 0 rgba(74,74,74,.3);
&__toggle {
overflow: hidden;
max-height: 55px;
p {
font-size: 16px;
margin-bottom: 10px;
}
}
&__title {
font-weight: 900;
margin-bottom: 5px;
}
&__header {
position: relative;
cursor: pointer;
&::after{
content: "\f078";
font-family: "Font Awesome 5 Pro";
font-weight: 400;
display: inline-block;
background-color: #d54f80;
border: 2px solid #d54f80;
color: #fff;
width: 30px;
height: 30px;
border-radius: 15px;
font-size: 14px;
text-align: center;
line-height: 2;
position: absolute;
top: 0;
right: 0;
transition: all .3s ease-in-out;
}
}
&.active {
.card__toggle {
max-height: 700px;
transition: all .3s ease-in-out;
}
.card__header {
&::after {
background-color: #fff;
color: red;
transform: rotate(180deg);
}
}
}
}
-----------------------------------------------------
$(document).ready(function() {
$(".js-toggle").on("click", function () {
$(".card__header.active").not($(this)).removeClass("active").next(".js-card-toggle").slideUp("slow");
$(this).toggleClass("active").next(".js-card-toggle").slideToggle("slow");
$(this).closest(".card").toggleClass("active").siblings().removeClass("active");
});
});```
I think you are trying to achieve this, copy it and see if it works.
HTML:
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">
“It’s not about weight it’s about how<br />
your body changes”
</p>
</div>
<div class="card__toggle">
<p>
Doing resistance training and cardio combined and I have not lost one
single ounce on the scale….I was feeling horribly frustrated being it has
been a month so I decided to do a progress sequence and wth look at me
now!! It’s not about weight, it’s about how your body changes when you eat
right and exercise! Yay!!”
</p>
</div>
</div>
<div class="card">
<div class="card__header js-toggle">
<p class="card__title">
“It’s not about weight it’s about how<br />
your body changes”
</p>
</div>
<div class="card__toggle">
Doing resistance training and cardio combined and I have not lost one single
ounce on the scale….I was feeling horribly frustrated being it has been a
month so I decided to do a progress sequence and wth look at me now!! It’s
not about weight, it’s about how your body changes when you eat right and
exercise! Yay!!”
</div>
</div>
SCSS:
.
card {
max-height: 125px;
overflow: hidden;
background-color: #fff;
max-width: 490px;
padding: 20px;
margin-bottom: 30px;
border-radius: 5px;
position: relative;
height: 150px;
box-sizing: border-box;
box-shadow: 0 3px 30px 0 rgba(74, 74, 74, 0.3);
transition: 0.4s ease;
&.active {
max-height: 210px;
}
&__toggle {
background-color: white;
p {
font-size: 16px;
margin-bottom: 10px;
}
}
&__title {
font-weight: 900;
margin-bottom: 5px;
}
&__header {
position: relative;
cursor: pointer;
&::after {
content: "\f078";
font-family: "Font Awesome 5 Pro";
font-weight: 400;
display: inline-block;
background-color: #d54f80;
border: 2px solid #d54f80;
color: #fff;
width: 30px;
height: 30px;
border-radius: 15px;
font-size: 14px;
text-align: center;
line-height: 2;
position: absolute;
top: 0;
right: 0;
transition: all 0.3s ease-in-out;
}
}
&.active {
.card__toggle {
transition: all 0.3s ease-in-out;
width: 100%;
z-index: 1;
background-color: white;
}
.card__header {
&::after {
background-color: #fff;
color: red;
transform: rotate(180deg);
}
}
}
}
jQuery:
$(".js-toggle").click(function () {
console.log($(this).parents(".card"));
$(this).parents(".card").toggleClass("active");
});
I managed to do find a solution after all.. I made changes to the css only
background-color: #fff;
max-width: 490px;
padding: 20px;
margin: 0 auto 70px auto;
border-radius: 5px;
position: relative;
box-sizing: border-box;
box-shadow: 0 3px 30px 0 rgba(74, 74, 74, 0.3);
&::after {
content: "";
position: absolute;
height: 20px;
background-color: #fff;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
bottom: -40px;
left: 0;
z-index: 10;
width: 100%;
box-shadow: 0 10px 20px -7px rgba(74, 74, 74, 0.3);
transition: all 0.3s ease-in-out;
transition-delay: 0.5s;
}
&__toggle {
overflow: hidden;
max-height: 45px;
position: absolute;
z-index: 1;
background-color: #fff;
margin-left: -20px;
padding-left: 20px;
padding-right: 20px;
border-radius: 5px;
box-shadow: 0 10px 15px -12px rgba(74, 74, 74, 0.3);
transition: all 1s ease-in-out;
p {
font-size: 16px;
margin-bottom: 20px;
line-height: 1.3;
}
&-s {
max-height: 18px;
}
}
&--s {
max-width: 350px;
}
&__img {
border: 5px solid #d54f80;
border-radius: 5px;
padding: 5px 5px 1px 5px;
margin-bottom: 20px;
}
&__title {
font-weight: 900;
margin-bottom: 5px;
}
&__header {
position: relative;
cursor: pointer;
&::after {
content: "\f078";
font-family: "Font Awesome 5 Pro";
font-weight: 400;
display: inline-block;
background-color: #d54f80;
border: 2px solid #d54f80;
color: #fff;
width: 30px;
height: 30px;
border-radius: 15px;
font-size: 14px;
text-align: center;
line-height: 2;
position: absolute;
top: 0;
right: 0;
transition: all 0.3s ease-in-out;
}
}
&.active {
&.card::after {
background-color: transparent;
transition: all 0s ease-in-out;
}
.card__toggle {
max-height: 700px;
}
.card__header {
&::after {
background-color: #fff;
color: pink;
transform: rotate(180deg);
}
}
}
}
How do I draw a horizontal line in between 2 circles in CSS?
It has to be in the middle of them just as shown in the screenshot.
Example here:
I have drawn the 2 circles, but don't know how to connect them.
#status-buttons a {
color: black;
display: inline-block;
font-size: 17px;
font-weight: normal;
margin-right: 0;
text-align: center;
text-transform: uppercase;
min-width: 150px;
text-decoration: none;
}
#status-buttons a:hover {
text-decoration: none;
}
#status-buttons a.active span {
color: white;
background: #ACCF5B;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
color: white;
background: #22bacb;
display: block;
height: 45px;
margin: 0 auto 10px;
padding-top: 20px;
width: 60px;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
<div id="status-buttons" class="text-center">
<span>1</span> Step 1
<span>2</span> Step 2
</div>
See demo on JSFiddle
You can use a pseudo-element to insert an absolutely-positioned border:
#status-buttons {
position: relative; /* 1 */
display: inline-block; /* 2 */
}
#status-buttons::after { /* 3 */
content: "";
position: absolute;
width: 50%;
z-index: -1; /* 4 */
top: 35%;
left: 25%;
border: 3px solid #ACCF5B;
}
#status-buttons a {
color: black;
display: inline-block;
font-size: 17px;
font-weight: normal;
margin-right: 0;
text-align: center;
text-transform: uppercase;
min-width: 150px;
text-decoration: none;
}
#status-buttons a:hover {
text-decoration: none;
}
#status-buttons a.active span {
color: white;
background: #ACCF5B;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
color: white;
background: #22bacb;
display: block;
height: 45px;
margin: 0 auto 10px;
padding-top: 20px;
width: 60px;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
<div id="status-buttons" class="text-center">
<span>1</span> Step 1
<span>2</span> Step 2
</div>
Notes:
Establish nearest positioned ancestor for absolute positioning.
Make container consume only the width necessary.
Insert pseudo element
Ensure that any horizontal line overlap doesn't appear above circles
You can add a new element and position it between the two circles:
#status-buttons a {
color: black;
display: inline-block;
font-size: 17px;
font-weight: normal;
margin-right: 0;
text-align: center;
text-transform: uppercase;
min-width: 150px;
text-decoration: none;
}
#status-buttons a:hover {
text-decoration: none;
}
#status-buttons a.active span {
color: white;
background: #ACCF5B;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
color: white;
background: #22bacb;
display: block;
height: 45px;
margin: 0 auto 10px;
padding-top: 20px;
width: 60px;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#line {
position: absolute;
top: 42px;
left: 112px;
width: 96px;
height: 5px;
background: #ACCF5B;
}
<div id="status-buttons" class="text-center">
<span>1</span> Step 1
<div id="line">
</div>
<span>2</span> Step 2
</div>
Here is one solution:
https://jsfiddle.net/sfyuxrs9/
It contains a div (which forms the line) which has position: absoluteand a negative z-index value. The rest ist just adjusting all the values for width/height/top and left
Here's the cleanest solution with flex
.timeline {
display: flex;
align-items: center;
justify-content: center;
}
.circle {
width: 13px;
height: 13px;
background: black;
border-radius: 50%;
}
.dashed {
width: 100px;
border: 1px dashed #C4C4C4;
}
<div class="timeline">
<div class="circle"></div>
<div class="dashed"></div>
<div class="circle"></div>
<div class="dashed"></div>
<div class="circle"></div>
</div>
I guess you can do some thing like this
check the following code snippet
#status-buttons a {
color: black;
display: inline-block;
font-size: 17px;
font-weight: normal;
margin-right: 0;
text-align: center;
text-transform: uppercase;
min-width: 150px;
text-decoration: none;
}
#status-buttons a:hover {
text-decoration: none;
}
#status-buttons a.active span {
color: white;
background: #ACCF5B;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
color: white;
background: #22bacb;
display: block;
height: 45px;
margin: 0 auto 10px;
padding-top: 20px;
width: 60px;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
div.linetop { border-top: 1px solid #111111; width:95px;
position:absolute;
top:40px;
left:115px;
}
<div id="status-buttons" class="text-center">
<span>1</span> Step 1
<span>2</span> Step 2
</div>
<div class="linetop"></div>
Hope this helps
Here you go.
<div id="status-buttons" class="text-center">
<span>1</span> Step 1
<span>2</span> Step 2
</div>
<div class="line">
</div>
The CSS
#status-buttons a {
position: relative;
color: black;
display: inline-block;
font-size: 17px;
font-weight: normal;
margin-right: 0;
text-align: center;
text-transform: uppercase;
min-width: 150px;
text-decoration: none;
z-index: 1;
}
#status-buttons a:hover {
text-decoration: none;
}
#status-buttons a.active span {
color: white;
background: #ACCF5B;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
#status-buttons span {
color: white;
background: #22bacb;
display: block;
height: 45px;
margin: 0 auto 10px;
padding-top: 20px;
width: 60px;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.792157) 3px 3px 3px 0;
}
.line {
position: absolute;
border-bottom: 5px solid black;
width: 20%;
left: 71px;
top: 39px;
z-index: 0;
}
https://jsfiddle.net/norcaljohnny/nwjz2010/
You can also use this method :)
.his-bar { display: flex; position: relative; padding-top: 50px; width: 100%; margin:auto; margin-top: 40px; }
.his-bar:before { content: ''; border: 1px solid #727272; position: absolute; top: 60px; right: 0; width: 99%; }
.his-bar .point { border: 2px solid #872071; width: 20px; height: 20px; border-radius: 50%; display: inline-block; background-color: #F8F8F8; z-index: 2; position: relative; }
.his-bar .point-start:after { content: '2000'; position: absolute; top: 30px; left: -7px; }
.his-bar .point-end { margin-left: auto; }
.his-bar .point-end:after { content: '2021'; position: absolute; top: 30px; left: -7px; }
<div class="his-bar">
<span class="point point-start"></span>
<span class="point point-end"></span>
</div>