I would like to create a Responsive vertical timeline as shown below.
sorry, I am backend developer not that strong in CSS.
I was able to achieve something as shown below
Currently, I am looking for help in positioning my div left right as shown in picture one.
I am planing to use bootstrap and fa Icon
My CSS:
$text-color: #373737;
$gray-base: #494949;
$gray-darker: #222;
$gray-dark: #333;
$gray: #555;
$gray-light: #777;
$gray-lighter: #eee;
$brand-primary: #1f9eba;
$brand-success: #59ba1f;
$brand-info: #5bc0de;
$brand-warning: #d1bd10;
$brand-danger: #ba1f1f;
/* Timeline */
.timeline {
list-style: none;
padding: 20px;
position: relative;
&:before {
top: 40px;
bottom: 0;
position: absolute;
content: " ";
width: 3px;
background-color: #eeeeee;
left: 50%;
margin-left: -1.5px;
}
.timeline-item {
margin-bottom: 20px;
position: relative;
&:before,
&:after {
content: "";
display: table;
}
&:after {
clear: both;
}
.timeline-badge {
color: #fff;
width: 54px;
height: 54px;
line-height: 52px;
font-size: 22px;
text-align: center;
position: absolute;
top: 18px;
left: 50%;
margin-left: -25px;
background-color: $gray-dark;
border: 3px solid #ffffff;
z-index: 100;
border-top-right-radius: 50%;
border-top-left-radius: 50%;
border-bottom-right-radius: 50%;
border-bottom-left-radius: 50%;
i,
.fa,
.glyphicon {
top: 2px;
left: 0px;
}
&.primary {
background-color: $brand-primary;
}
&.info {
background-color: $brand-info;
}
&.success {
background-color: $brand-success;
}
&.warning {
background-color: $brand-warning;
}
&.danger {
background-color: $brand-danger;
}
}
.timeline-panel {
position: relative;
text-align: right;
width: 46%;
float: left;
right: 16px;
// border: 1px solid $gray-light;
background: #ffffff;
border-radius: 2px;
padding: 20px;
-webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
&:before {
position: absolute;
top: 26px;
right: -16px;
display: inline-block;
border-top: 16px solid transparent;
border-left: 16px solid $gray-light;
border-right: 0 solid $gray-light;
border-bottom: 16px solid transparent;
// content: " ";
}
.timeline-title {
margin-top: 0;
color: inherit;
}
.timeline-body > p,
.timeline-body > ul {
margin-bottom: 0;
}
.timeline-body > p + p {
margin-top: 5px;
}
}
}
.timeline-item:last-child {
&:nth-child(even) {
float: right;
}
}
.timeline-item:nth-child(even) {
.timeline-panel {
float: right;
text-align: left;
left: 16px;
&:before {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
}
}
}
// .timeline-horizontal:extend(.timeline) {
// list-style: none;
// position: relative;
// padding: 20px 0px 20px 0px;
// display: inline-block;
// &:before {
// height: 3px;
// top: auto;
// bottom: 26px;
// left: 56px;
// right: 0;
// width: 100%;
// margin-bottom: 20px;
// }
// .timeline-item {
// display: table-cell;
// height: 280px;
// width: 20%;
// min-width: 320px;
// float: none !important;
// padding-left: 0px;
// padding-right: 20px;
// margin: 0 auto;
// vertical-align: bottom;
// .timeline-panel {
// top: auto;
// bottom: 64px;
// display: inline-block;
// float: none !important;
// left: 0 !important;
// right: 0 !important;
// width: 100%;
// margin-bottom: 20px;
// &:before {
// top: auto;
// bottom: -16px;
// left: 28px !important;
// right: auto;
// border-right: 16px solid transparent !important;
// border-top: 16px solid $gray-light !important;
// border-bottom: 0 solid $gray-light !important;
// border-left: 16px solid transparent !important;
// }
// }
// &:before,
// &:after {
// display: none;
// }
// .timeline-badge {
// size: 3em;
// top: auto;
// bottom: 0px;
// left: 43px;
// }
// }
// }
My HTML:
<div class="row">
<div class="col-md-12">
<div class="page-header">
<h1>Timeline</h1>
</div>
<ul class="timeline">
<li class="timeline-item">
<div class="timeline-badge">
<fa-icon [icon]="faCheck"></fa-icon>
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">Mussum ipsum cacilds 1</h4>
<p><small class="text-muted"><i class="glyphicon glyphicon-time"></i> 11 hours ago via Twitter</small></p>
</div>
</div>
<div style="float: right; position: relative;text-align: right;"> Hello </div>
</li>
<li class="timeline-item">
<div class="timeline-badge"><i class="glyphicon glyphicon-check"></i></div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">Mussum ipsum cacilds 2</h4>
<p><small class="text-muted"><i class="glyphicon glyphicon-time"></i> 11 hours ago via Twitter</small></p>
</div>
<div class="timeline-body">
<p>Test</p>
</div>
</div>
</li>
<li class="timeline-item">
<div class="timeline-badge"><i class="glyphicon glyphicon-check"></i></div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">Mussum ipsum cacilds 3</h4>
<p><small class="text-muted"><i class="glyphicon glyphicon-time"></i> 11 hours ago via Twitter</small></p>
</div>
<div class="timeline-body">
<p>Test Content 1 </p>
<p>Test Content 2 </p>
</div>
</div>
</li>
<li class="timeline-item">
<div class="timeline-badge"><i class="glyphicon glyphicon-check"></i></div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="timeline-title">Mussum ipsum cacilds 4</h4>
<p><small class="text-muted"><i class="glyphicon glyphicon-time"></i> 11 hours ago via Twitter</small></p>
</div>
<div class="timeline-body">
<p>Test </p>
</div>
</div>
</li>
</ul>
</div>
</div>
Note: I took this sample from https://codepen.io/wdmg/pen/ZWmwNM
Any help is much appreciated.
This works for me
Result
Code:
<html><body>
<style>
.bold{font-weight:bold;}
.time{position:absolute; left:-110px;}
.timeline-wrapper {
padding-left:80px;
min-width: 400px;
font-family: 'Helvetica';
font-size: 14px;
/*border: 1px solid #CCC;*/
}
.StepProgress {
position: relative;
padding-left: 45px;
list-style: none;
}
.StepProgress::before {
display: inline-block;
content: '';
position: absolute;
top: 0;
left: 15px;
width: 10px;
height: 100%;
border-left: 2px solid #CCC;
}
.StepProgress-item {
position: relative;
counter-increment: list;
}
.StepProgress-item:not(:last-child) {
padding-bottom: 20px;
}
.StepProgress-item::before {
display: inline-block;
content: '';
position: absolute;
left: -30px;
height: 100%;
width: 10px;
}
.StepProgress-item::after {
content: '';
display: inline-block;
position: absolute;
top: 0;
left: -37px;
width: 12px;
height: 12px;
border: 2px solid #CCC;
border-radius: 50%;
background-color: #FFF;
}
.StepProgress-item.is-done::before {
border-left: 2px solid green;
}
.StepProgress-item.is-done::after {
/*content: "?";*/
font-size: 10px;
color: #FFF;
text-align: center;
border: 2px solid green;
background-color: green;
}
/*.StepProgress-item.current::before {
border-left: 2px solid green;
}
.StepProgress-item.current::after {
content: counter(list);
padding-top: 1px;
width: 19px;
height: 18px;
top: -4px;
left: -40px;
font-size: 14px;
text-align: center;
color: green;
border: 2px solid green;
background-color: white;
}*/
.StepProgress strong {
display: block;
}
</style>
<div class="timeline-wrapper">
<ul class="StepProgress">
<li class="StepProgress-item is-done">
<div class="bold time">10:00 Am</div>
<div class="bold">Step 1</div>
</li>
<li class="StepProgress-item is-done">
<div class="bold time">11:00 Am</div>
<div class="bold">Step 2</div>
<div>En proceso</div>
</li>
<li class="StepProgress-item current">
<div class="bold time">12:00 Pm</div>
<div class="bold">Step 3</div>
</li>
<li class="StepProgress-item">
<div class="bold time">01:00 Pm</div>
<div class="bold">Step 4</div>
</li>
<li class="StepProgress-item">
<div class="bold time">02:00 Pm</div>
<div class="bold">Step 5</div>
</li>
</ul>
</div>
</body></html>
Related
I'm trying to make a google clone page, I am trying to make the footer to be sticked to the end of the viewport. But when I try position: absolute bottom: 0, it sticks to the end, but the page overflows.
I tried to use html, body and * height: 100% but it doesn't work.
I share my github repository for you to check the code: https://github.com/Diefonro/HTML-CSS
You can also check the webpage (on a PC) at: https://diefonro.github.io/HTML-CSS/
Code:
<body>
<header>
<nav>
<div class="nav">
<div id="nav-g-i">
<a class="menu-item" href="#">Gmail</a>
<a class="menu-item" href="https://google.com/imghp">Images</a>
</div>
<div class="" id="nav-gr-a">
<div class="dd-cont">
<div class="grid">
<img
id="grid"
src="assets/icons/apps_black_24dp.svg"
alt="apps-icon"
/>
</div>
<div class="drop-d">
<div class="dd-item">
<img
id="dd-search"
src="assets/icons/google-logo-dd.png"
alt="google-search-icon"
/>
<p>Search</p>
</div>
<div class="dd-item">
<img
id="dd-maps"
src="assets/icons/google-maps-dd.png"
alt="google-maps-icon"
/>
<p>Maps</p>
</div>
<div class="dd-item">
<img
id="dd-keep"
src="assets/icons/google-keep-dd.png"
alt="google-keep-icon"
/>
<p>Keep</p>
</div>
<div class="dd-item">
<img
class="dd-drive"
src="assets/icons/Google_Drive_dd.png"
alt="google-keep-icon"
/>
<p>Drive</p>
</div>
<div class="dd-item">
<img
class="dd-calendar"
src="assets/icons/512px-Google_Calendar_icon_dd.png"
alt="google-calendar-icon"
/>
<p>Calendar</p>
</div>
<div class="dd-item">
<img
class="dd-photos"
src="assets/icons/google_photos-dd.png"
alt="google-photos-icon"
/>
<p>Photos</p>
</div>
</div>
</div>
<img
id="profile-pic"
src="assets/icons/account_circle_black_24dp.svg"
alt="account-icon"
/>
</div>
</div>
</nav>
</header>
<main>
<section>
<div class="logo-cont">
<img
id="google-logo"
src="assets/images/googlelogo_color_272x92dp.png"
alt="google-logo"
/>
</div>
<div class="input-cont">
<input class="input-g" type="text" />
<img
src="assets/icons/search_black_24dp.svg"
alt="search-icon"
class="search-i"
/>
<img
class="mic"
src="assets/icons/Google_mic.svg.png"
alt="voice-search-icon"
/>
</div>
<div class="btn-cont">
<button class="custom-btn">Google Search</button>
<button class="custom-btn custom-btn-l">I'm Feeling Lucky</button>
</div>
<span class="s-lang"
>Google offered in:
<a href="#" class="s-link"
><div class="ll">Español (Latinoamérica)</div></a
>
</span>
</section>
</main>
<footer>
<div class="footer-cont">
<div class="top-footer">
<span class="f1">Colombiac test</span>
</div>
<div class="bottom-footer">
<div class="left-footer">
<div class="a-li">
About
Advertising
Business
How Search works
</div>
</div>
<div class="right-footer">
Privacy
Terms
Settings
</div>
</div>
</div>
</footer>
</body>
* {
margin: 0;
}
html{
height: 100vh;
}
body {
font-family: Arial, sans-serif;
}
nav {
text-align: right;
position: relative;
top: 9px;
right: 8px;
}
#nav-g-i {
display: inline-block;
position: relative;
top: 2px;
right: 23px;
}
#nav-gr-a {
display: inline-block;
position: relative;
top: 5px;
right: 10px;
}
#grid,
#profile-pic {
opacity: 50%;
}
section {
text-align: center;
position: relative;
top: 24px;
}
.input-g {
position: relative;
bottom: 2px;
width: 500px;
line-height: 17px;
border: none;
outline: none;
}
.input-cont {
width: 553px;
height: 16px;
position: relative;
bottom: 2px;
right: 1px;
color: #222;
border: 1px solid #dfe1e5;
font-size: 13px;
padding: 14px;
border-radius: 80px;
margin: 24px 0px;
display: inline-block;
}
.input-cont:hover,
.input-cont:focus {
box-shadow: 0 1px 5px 0 rgba(32, 33, 36, 0.28);
border-color: rgba(40, 40, 41, 0);
}
.input-cont > img {
position: absolute;
top: 10px;
right: 11px;
width: 23px;
}
.input-cont .search-i {
position: absolute;
top: 11.5px;
right: 547px;
width: 20px;
opacity: 40%;
}
#grid {
position: relative;
bottom: 3px;
margin-right: 16px;
}
.menu-item {
font-size: 13px;
color: #5b5f63;
text-decoration: none;
position: relative;
bottom: 8px;
margin-right: 10px;
}
.menu-item:hover {
text-decoration: underline;
}
#profile-pic {
width: 32px;
height: 32px;
}
.btn-cont {
position: relative;
top: 3px;
}
.custom-btn {
background-color: #f2f2f291;
color: #a2a8af;
font-size: 14px;
height: 36px;
padding: 0 16px;
background-image: linear-gradient(top, #f5f5f5, #f1f1f1);
border: 1px solid transparent;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0);
color: #222;
border-radius: 5px;
}
.custom-btn:first-of-type {
margin-right: 7px;
}
.custom-btn:hover {
border: 1px solid #c6c6c656;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
color: #222;
}
.custom-btn:active {
border: 1px solid cornflowerblue;
}
.drop-d {
width: 285px;
padding: 10px;
border: 1px solid #ccc;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
text-align: center;
position: absolute;
right: 11px;
border-radius: 12px;
display: none;
}
.grid:hover {
display: inline-block;
}
.dd-item:hover {
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 8px;
}
.dd-item {
margin-top: 10px;
display: inline-block;
width: 70px;
padding: 6px 3px;
}
.dd-item > img {
height: 50px;
width: 50px;
}
.dd-item > p {
color: rgba(0, 0, 0, 0.87);
margin: 0;
margin-top: 15px;
margin-bottom: 5px;
}
.dd-cont {
display: inline-block;
}
.dd-cont:hover .drop-d {
display: block;
}
.s-lang {
font-size: 13px;
color: #333;
position: relative;
top: 30px;
right: 3px;
}
.s-lang a {
text-decoration: underline;
}
.s-lang a:visited {
color: rgb(30, 30, 179);
}
.ll {
display: inline-block;
position: relative;
left: 3px;
}
.top-footer,
.bottom-footer {
font-size: 15px;
background-color: #d6d8da49;
color: #8a8686;
position: relative;
top: 200px;
}
.top-footer{
border-bottom: 1px solid rgba(155, 155, 155, 0.267);
}
.left-footer a {
display: inline-block;
text-decoration: none;
padding: 12px;
font-size: 14px;
}
.right-footer a {
font-size: 14px;
padding: 14px;
text-decoration: none;
color: #8a8686;
}
.bottom-footer{
display: flex;
justify-content: space-between;
align-items: center;
}
.bottom-footer a:hover{
text-decoration: underline;
}
span.f1 {
display: inline-block;
margin-left: 15px;
padding: 16px;
}
.a-li {
margin-left: 20px;
}
a:visited {
color: inherit;
}
.footer-cont {
position: absolute;
bottom: 0;
width: 100%;
left: 0;
height: fit-content;
height: -moz-fit-content;
}
footer{
position: relative;
width: 100vw;
}
You can remove top: 200px on .top-footer, .bottom-footer. Why? because you have added bottom: 0 to .footer-cont which increases its position to 0 (.footer-cont) + 200px (.top-footer, .bottom-footer) = 200px down. If scroll bars in vertical bother you, you can add overflow-y: hidden style to body or html.
I am making testimonial feature in a carousel
This is the sample pic of what I wanted to achieve
And this is what I've achieved so far
https://jsfiddle.net/2we347xu/
but this time I wanted to make the top part of the rectangle a bit more rounded like the bottom part of it and so I used border-radius but it didn't turn out the way I wanted.
Here is my code
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
}
.col-center {
margin: 0 auto;
float: none !important;
}
.carousel {
margin: 0px auto;
padding: 0 70px;
height: 100%;
background: linear-gradient(180deg, white 15%,#0E2149 15%);
border-radius: 20px;
}
.carousel {
position: relative;
}
.carousel .item {
color: #fff;
font-size: 14px;
text-align: center;
overflow: hidden;
min-height: 290px;
}
.carousel .item .img-box {
width: 200px;
height: 200px;
margin: 0 auto;
padding: 5px;
border: 10px solid #0E2149;
border-radius: 50%;
background: #fff;
}
.carousel .img-box img {
width: 100%;
height: 100%;
display: block;
border-radius: 50%;
}
.carousel .testimonial {
padding: 0px 0 0px;
line-height: 1.5;
color: #fff;
}
.carousel .overview {
font-style: italic;
}
.carousel .overview b {
text-transform: uppercase;
color: #7AA641;
}
.carousel .carousel-control {
width: 40px;
height: 40px;
margin-top: -20px;
top: 50%;
background: none;
}
.carousel-control i {
font-size: 30px;
line-height: 65px;
position: absolute;
display: inline-block;
color: rgba(0, 0, 0, 0.8);
text-shadow: 0 3px 3px #e6e6e6, 0 0 0 #000;
margin-left: -5px;
}
.carousel .carousel-indicators {
bottom: -40px;
}
.carousel-indicators li, .carousel-indicators li.active {
width: 10px;
height: 10px;
margin: 1px 3px;
border-radius: 50%;
}
.carousel-indicators li {
background: #999;
border-color: transparent;
box-shadow: inset 0 2px 1px rgba(0,0,0,0.2);
}
.carousel-indicators li.active {
background: #555;
box-shadow: inset 0 2px 1px rgba(0,0,0,0.2);
}
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Carousel indicators -->
<!-- Wrapper for carousel items -->
<div class="carousel-inner">
<div class="item carousel-item active">
<div class="img-box"><img src="images/cd logo.jpg" alt=""></div>
<p class="testimonial">Some text here
</p>
<p class="overview"><b>Paula Wilson</b>, Media Analyst</p>
</div>
<div class="item carousel-item">
<div class="img-box"><img src="/examples/images/clients/2.jpg" alt=""></div>
<p class="testimonial">Text here</p>
<p class="overview"><b>Antonio Moreno</b>, Web Developer</p>
</div>
</div>
<!-- Carousel controls -->
<a class="carousel-control left carousel-control-prev" href="#myCarousel" data-slide="prev">
<i class="fa fa-angle-left"></i>
</a>
<a class="carousel-control right carousel-control-next" href="#myCarousel" data-slide="next">
<i class="fa fa-angle-right"></i>
</a>
</div>
</div>
<div id="background"></div>
</div>
</div>
How do I achieve the look at the top part of the carousel?
Instead of that gradient you can use :before or :after pseudo elements, position it absolutely, under all other content, and do what you want.
It seems that it's working perfectly as expected. The problem here is that you are not able to view it because the background color of the top bar is white and so is your body background color. If you change it to something else, you'll see the difference.
Either you change the color of the linear gradient to
.carousel {
...
background: linear-gradient(180deg, grey 15%,#0E2149 15%);
/* You can use any other color than grey, it's just for demo purpose */
...
}
Or you can use pseudo selectors for achieving what you want.
Here's an example using ::before by setting it's position to absolute:
.carousel {
/* remove linear gradient from here! */
}
.carousel::after {
position: absolute;
left: 0;
top: 15%;
content: ' ';
width: 100%;
height: 85%;
background: #0E2149;
z-index: -1; /* To keep it below the content */
border-radius: 20px;
}
.carousel::before {
position: absolute;
left: 0;
top: 0;
content: ' ';
width: 100%;
height: 20%; /* Extra 5% */
background: white;
z-index: -2; /* To keep it below the content and the ::after element */
}
Are u expecting like this:
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
margin-bottom: 20px;
border-radius: 15px;
box-shadow: 0 4px 10px 0 rgba(0,0,0,0.2), 0 4px 20px 0 rgba(0,0,0,0.19);
}
hr{
margin:2px 40px;
background-color:#cbcbcb;
color: #cbcbcb;
border-radius: 10px;
}
.col-center {
margin: 0 auto;
float: none !important;
}
.carousel {
margin: 0px auto;
padding: 0 70px;
height: 100%;
border-radius: 20px;
}
.carousel {
position: relative;
}
.carousel .item {
color: #fff;
font-size: 14px;
background-color: white;
text-align: center;
overflow: hidden;
min-height: 290px;
position: relative;
}
.carousel .item::after{
content: "";
display: block;
background-color:#0E2149;
position: absolute;
left: 0;
right: 0;
top: 100px;
bottom: 0;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
}
.carousel .item > *{
position: relative;
z-index: 1;
}
.carousel .item .img-box {
width: 130px;
height: 130px;
margin: 0 auto;
margin-top: 25px;
border-radius: 50%;
padding: 10px;
background-color:#0E2149 ;
}
.carousel .img-box img {
width: 100%;
height: 100%;
display: block;
border-radius: 50%;
}
.carousel .testimonial {
padding: 0px 0 0px;
line-height: 1.5;
color: white;
font-weight: bold;
font-size: 30px;
}
.carousel .overview {
font-style: italic;
}
.carousel .overview b {
text-transform: uppercase;
color: #7AA641;
}
.carousel .carousel-control {
width: 40px;
height: 40px;
margin-top: -20px;
top: 50%;
background: none;
}
.carousel-control i {
font-size: 30px;
line-height: 65px;
position: absolute;
display: inline-block;
color: rgba(0, 0, 0, 0.8);
text-shadow: 0 3px 3px #e6e6e6, 0 0 0 #000;
margin-left: -5px;
}
.carousel .carousel-indicators {
bottom: -40px;
}
.carousel-indicators li, .carousel-indicators li.active {
width: 10px;
height: 10px;
margin: 1px 3px;
border-radius: 50%;
}
.carousel-indicators li {
background: #999;
border-color: transparent;
box-shadow: inset 0 2px 1px rgba(0,0,0,0.2);
}
.carousel-indicators li.active {
background: #555;
box-shadow: inset 0 2px 1px rgba(0,0,0,0.2);
}
<section class="second-section">
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Carousel indicators -->
<!-- Wrapper for carousel items -->
<div class="carousel-inner">
<div class="item carousel-item active">
<div class="img-box"><img src="https://dummyimage.com/300" alt=""></div>
<p class="testimonial">Some text here
</p>
<hr>
<p class="overview"><b>Paula Wilson</b>, Media Analyst</p>
</div>
</div>
<div class="carousel-inner">
<div class="item carousel-item">
<div class="img-box"><img src="https://dummyimage.com/300" alt=""></div>
<p class="testimonial">Text here</p>
<p class="overview"><b>Antonio Moreno</b>, Web Developer</p>
</div>
</div>
<div class="carousel-inner">
<div class="item carousel-item">
<div class="img-box"><img src="https://dummyimage.com/300" alt=""></div>
<p class="testimonial">Text here</p>
<p class="overview"><b>Antonio Moreno</b>, Web Developer</p>
</div>
</div>
</div>
<!-- Carousel controls -->
<a class="carousel-control left carousel-control-prev" href="#myCarousel" data-slide="prev">
<i class="fa fa-angle-left"></i>
</a>
<a class="carousel-control right carousel-control-next" href="#myCarousel" data-slide="next">
<i class="fa fa-angle-right"></i>
</a>
</div>
</div>
<div id="background"></div>
</div>
</div>
</div>
</section>
HOME This is the code I have.
<div class="row">
<div class="col-sm">
</div>
<div class="col-sm">
<p align="center" class="savings-calculator-p">SAVINGS CALCULATOR</p>
</div>
<div class="col-sm">
</div>
</div>
How to make the UI like the below one
Like This
A bit of CSS trickery and you get an almost exact replica of what you are after.
*You can play around with the settings to get the look you want. See the 2 images for examples.
Pure & Simple - Quick & Easy CSS
No external scripts or javaScrtipt required. :)
body {
padding-top: 15px;
}
.myContent {
border: 0.8px solid #ddd;
}
#myPage .savings {
position: relative;
border: 1px solid #ddd;
border-bottom: none;
border-radius: 8px 8px 0 0;
box-shadow: 0 0 4px #ccc;
font-size: 14px;
text-align: center;
font-weight: bold;
color: #777;
font-family: arial;
margin: 0 auto;
padding: 8px 10px 6px 10px;
max-width: 180px;
}
#myPage .savings:after,
#myPage .savings:before {
position: absolute;
left: 50%;
top: 100%;
border: solid transparent;
content: "";
}
#myPage .savings:before {
margin-left: -14px;
border-width: 20px;
border-top-color: #eee;
}
#myPage .savings:after {
border-top-color: #ffffff;
border-width: 16px;
margin-left: -10px;
}
<div id="myPage">
<div class="savings">
SAVINGS CALCULATOR
</div>
<div class="myContent">
</div>
</div>
Try this and you're done...
p.savings-calculator-p {
background-color: #EEE;
width: max-content;
padding: 5px 20px;
margin: auto;
margin-top: 20px;
border-radius: 5px;
position: relative;
filter: drop-shadow(0px 0px 2px rgba(0,0,0,0.4));
}
p.savings-calculator-p:after {
display: block;
content: '';
position: absolute;
top: 70%;
left: 0;
right: 0;
margin: auto;
background: #EEE;
width: 20px;
height: 20px;
z-index: -1;
transform: rotateZ(45deg);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.bundle.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-sm">
</div>
<div class="col-sm">
<p align="center" class="savings-calculator-p">SAVINGS CALCULATOR</p>
</div>
<div class="col-sm">
</div>
</div>
Use this tool to generate a custom css - http://www.cssarrowplease.com/, or use the below code snippet
.arrow_box {
font-size: 12px;
text-align: center;
max-width: 200px;
margin: 0 auto;
padding: 10px;
position: relative;
background: #ffffff;
font-family: sans-serif;
border: 1px solid #cccccc;
}
.arrow_box:after, .arrow_box:before {
top: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.arrow_box:after {
border-color: rgba(255, 255, 255, 0);
border-top-color: #ffffff;
border-width: 10px;
margin-left: -10px;
}
.arrow_box:before {
border-color: rgba(204, 204, 204, 0);
border-top-color: #cccccc;
border-width: 11px;
margin-left: -11px;
}
<div class="arrow_box">
SAVINGS CALCULATOR
</div>
I guess this will be helpful for you.
$(document).ready(function(){
$('.col-sm-4').on('mouseover', function(ev) {
$('.savings-calculator-p').addClass('show');
$('.savings-calculator-p').css('left', ev.clientX - 80 + 'px');
})
$('.col-sm-4').on('mousemove', function(ev) {
$('.savings-calculator-p').css('left', ev.clientX - 80 + 'px');
})
$('.col-sm-4').on('mouseleave', function(ev) {
$('.savings-calculator-p').removeClass('show')
})
})
.row {
position: relative;
display: flex;
}
.col-sm-4 {
flex: 1;
display: flex;
justify-content: center;
margin-top: 50px;
}
.savings-calculator-p {
font-size: 12px;
display: inline-block;
text-align: center;
max-width: 200px;
margin: 0 auto;
padding: 10px;
position: fixed;
background: #ffffff;
font-family: sans-serif;
border: 1px solid #cccccc;
transition: all 0.3s ease;
opacity: 0;
visibility: visible;
}
.show {
opacity: 1;
visibility: visible;
}
.savings-calculator-p:after, .savings-calculator-p:before {
top: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.savings-calculator-p:after {
border-color: rgba(255, 255, 255, 0);
border-top-color: #ffffff;
border-width: 10px;
margin-left: -10px;
}
.savings-calculator-p:before {
border-color: rgba(204, 204, 204, 0);
border-top-color: #cccccc;
border-width: 11px;
margin-left: -11px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row">
<p align="center" class="savings-calculator-p">SAVINGS CALCULATOR</p>
<div class="col-sm-4">
Header 1
</div>
<div class="col-sm-4">
Header 2
</div>
<div class="col-sm-4">
Header 3
</div>
</div>
Use Bootstrap popover and always show it
Since you are already using bootstrap, you should go for popover. It is concise and hence easy to maintain.
$('.popover-visible') .popover('show') .off('click');
<div class="container">
<div class="row pt-5">
<div class="col-sm ">
</div>
<div class="col-sm popover-visible mt-5"
data-container="body"
data-toggle="popover"
data-placement="top"
data-content="SAVINGS CALCULATOR">
<p align="center" class="savings-calculator-p">CURRENT SAVING DONE(R)</p>
</div>
<div class="col-sm">
</div>
</div>
</div>
https://codepen.io/anon/pen/wYJERz
I have problem with make process steps. It should look like this: http://imgur.com/a/fpMjy
I have problem with this "arrows", how to make border dashed?
How can I make to use different color on each step?
What I have:
.step > p {
margin: 0;
}
.step {
border: 1px solid #000;
text-align: center;
padding: 10px 10px 10px 30px;
min-width: 180px;
float: left;
position: relative;
background: #ebeef0;
}
.step:after,
.step:before {
content: " ";
position: absolute;
top: 0;
right: -17px;
width: 0;
height: 0;
border-top: 27px solid transparent;
border-bottom: 27px solid transparent;
border-left: 17px solid #ebeef0;
z-index: 2;
transition: border-color 0.2s ease;
}
.step:before {
border-top: 27px solid transparent;
border-bottom: 28px solid transparent;
border-left: 16px solid #000;
}
.actual-step {
background: #cfd6d9;
}
.actual-step:after {
border-left: 17px solid #cfd6d9;
}
.step-description {
font-size: 13px;
}
<div class="row text-center">
<div class="col-md-4 step actual-step">
<p class="step-number">Krok 1</p>
<p class="step-description">Podaj nazwę użytkownika</p>
</div>
<div class="col-md-4 step">
<p class="step-number">Krok 2</p>
<p class="step-description">Weryfikacja konta</p>
</div>
<div class="col-md-4 step">
<p class="step-number">Krok 3</p>
<p class="step-description">Zakończenie rejestracji</p>
</div>
</div>
https://jsfiddle.net/100dLq22/
.step > p {
margin: 0;
}
.step {
border: 1px dashed #000;
text-align: center;
padding: 10px 10px 10px 30px;
min-width: 180px;
float: left;
position: relative;
background: #ebeef0;
}
.step:after {
content: "";
position: absolute;
top: 9px;
right: -20px;
width: 40px;
transform: rotate(45deg);
height: 40px;
background-color: #ebeef0;
border-top: 1px dashed black;
border-right: 1px dashed black;
transition: border-color 0.2s ease;
}
.actual-step {
background: #cfd6d9;
}
.actual-step:after {
background-color: #cfd6d9;
}
.step-description {
font-size: 13px;
}
#step1:after {
z-index: 2;
}
#step2:after {
z-index: 4;
}
<div class="row text-center">
<div class="col-md-4 step actual-step" id="step1">
<p class="step-number">Step 1</p>
<p class="step-description">Etiam ullamcorper.</p>
</div>
<div class="col-md-4 step" id="step2">
<p class="step-number">Step 2</p>
<p class="step-description">Etiam ullamcorper.</p>
</div>
<div class="col-md-4 step">
<p class="step-number">Step 3</p>
<p class="step-description">Etiam ullamcorper.</p>
</div>
</div>
I am trying to do sharp corners in css, it works only 50%, if you check the jsfiddle you will notice that on border top left and top right on the blue ribbon banner a remaining border which should not be there. How can I remove that border?
http://jsfiddle.net/XSs9L/699/
HTML
<div class="wrap_post_course">
<div class="ribbon_banner mega_course"><span class="name_type"><span class="tl"></span><span class="tr"></span>MEGA COURSES</span>
</div>
<div class="post_item post_item_courses post_item_courses_3 post_format_standard odd">
<div class="course-preview -course post_content ih-item colored square effect_dir left_to_right">
<div class="course-image post_featured img">
<a href="http://newskillsacademy.co.uk/course/ultimate-writing-course/"><img width="331" height="166" sizes="(max-width: 331px) 100vw, 331px" srcset="http://newskillsacademy.co.uk/wp-content/uploads/2016/04/writing-course-1-331x166.jpg 331w, http://newskillsacademy.co.uk/wp-content/uploads/2016/04/writing-course-1-75x39.jpg 75w"
alt="Writing Course" class="attachment-homepage-thumb size-homepage-thumb wp-post-image" src="http://newskillsacademy.co.uk/wp-content/uploads/2016/04/writing-course-1-331x166.jpg"></a>
</div>
<div class="course-meta">
<header class="course-header">
<h5 class="nomargin">The Ultimate Writing Course</h5>
</header>
</div>
<div class="course-price product-price">
<div class="price-text"><del><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>598.00</span></del> <ins><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>399.00</span></ins></div>
</div>
<section class="find-more-now">
FIND OUT MORE
</section>
</div>
</div>
</div>
CSS
.ribbon_banner {
float: right;
position: relative;
width: 75px;
z-index: 99;
}
.ribbon_banner span.name_type {
background: #17a9ce none repeat scroll 0 0;
box-shadow: 0 3px 5px -7px rgba(0, 0, 0, 1);
color: #fff;
display: block;
font-size: 16px;
font-weight: bold;
line-height: 20px;
margin-left: -50px;
margin-top: 29px;
padding: 5px;
position: absolute;
text-align: center;
text-transform: uppercase;
transform: rotate(45deg);
width: 152px;
}
.ribbon_banner span.name_type:before {
content: "";
position: absolute;
left: 0px;
top: 100%;
z-index: -1;
border-color: #17a9ce transparent transparent #17a9ce;
border-style: solid;
border-width: 3px;
}
.ribbon_banner span.name_type:after {
content: "";
position: absolute;
right: 0px;
top: 100%;
z-index: -1;
border-color: #17a9ce transparent transparent #17a9ce;
border-style: solid;
border-width: 3px;
}
.ribbon_banner .tl,
.ribbon_banner .tr,
.ribbon_banner .bl,
.ribbon_banner .br {
width: 0;
height: 0;
position: absolute;
}
.ribbon_banner .tl {
top: 0;
left: 0;
border-top: 24px solid #f4f7f9;
border-right: 24px solid transparent;
}
.ribbon_banner .tr {
top: 0;
right: 0;
border-top: 24px solid #f4f7f9;
border-left: 24px solid transparent;
}
.wrap_post_course {
display: inline-block;
margin: 40px;
width: 335px;
}
it seems to be a bug when rendering a rotated element because there is no such effect when the degree is 0. So I suggest to move .tr and .tl one pixel outer to wrap the effect.
.ribbon_banner {
float: right;
position: relative;
width: 75px;
z-index: 99;
}
.ribbon_banner span.name_type {
background: #17a9ce none repeat scroll 0 0;
box-shadow: 0 3px 5px -7px rgba(0, 0, 0, 1);
color: #fff;
display: block;
font-size: 16px;
font-weight: bold;
line-height: 20px;
margin-left: -50px;
margin-top: 29px;
padding: 5px;
position: absolute;
text-align: center;
text-transform: uppercase;
transform: rotate(45deg);
width: 152px;
}
.ribbon_banner span.name_type:before {
content: "";
position: absolute;
left: 0px;
top: 100%;
z-index: -1;
border-color: #17a9ce transparent transparent #17a9ce;
border-style: solid;
border-width: 3px;
}
.ribbon_banner span.name_type:after {
content: "";
position: absolute;
right: 0px;
top: 100%;
z-index: -1;
border-color: #17a9ce transparent transparent #17a9ce;
border-style: solid;
border-width: 3px;
}
.ribbon_banner .tl,
.ribbon_banner .tr,
.ribbon_banner .bl,
.ribbon_banner .br {
width: 0;
height: 0;
position: absolute;
}
.ribbon_banner .tl {
top: -1px;
left: -1px;
border-top: 24px solid #f4f7f9;
border-right: 24px solid transparent;
}
.ribbon_banner .tr {
top: -1px;
right: -1px;
border-top: 24px solid #f4f7f9;
border-left: 24px solid transparent;
}
.wrap_post_course {
display: inline-block;
margin: 40px;
width: 335px;
}
<div class="wrap_post_course">
<div class="ribbon_banner mega_course"><span class="name_type"><span class="tl"></span><span class="tr"></span>MEGA COURSES</span>
</div>
<div class="post_item post_item_courses post_item_courses_3 post_format_standard odd">
<div class="course-preview -course post_content ih-item colored square effect_dir left_to_right">
<div class="course-image post_featured img">
<a href="http://newskillsacademy.co.uk/course/ultimate-writing-course/"><img width="331" height="166" sizes="(max-width: 331px) 100vw, 331px" srcset="http://newskillsacademy.co.uk/wp-content/uploads/2016/04/writing-course-1-331x166.jpg 331w, http://newskillsacademy.co.uk/wp-content/uploads/2016/04/writing-course-1-75x39.jpg 75w"
alt="Writing Course" class="attachment-homepage-thumb size-homepage-thumb wp-post-image" src="http://newskillsacademy.co.uk/wp-content/uploads/2016/04/writing-course-1-331x166.jpg"></a>
</div>
<div class="course-meta">
<header class="course-header">
<h5 class="nomargin">The Ultimate Writing Course</h5>
</header>
</div>
<div class="course-price product-price">
<div class="price-text"><del><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>598.00</span></del> <ins><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>399.00</span></ins></div>
</div>
<section class="find-more-now">
FIND OUT MORE
</section>
</div>
</div>
</div>