I'm trying to code this design:
And this is the code I have:
.container-flex {
display: flex;
flex-flow: row;
height: 100px;
}
.left {
flex: 1;
background-color: #2C77A5;
padding-top: 2%;
border-top-left-radius: 6px;
height: 100px;
}
.main {
display: flex;
flex-direction: column;
}
.top {
background: #27698D;
border-bottom: 1px solid #2a2a2a;
border-top-right-radius: 6px;
width: 42px;
height: 50px;
padding-left: 14px;
padding-top: 14px;
}
.middle {
background: #27698D;
border-bottom-right-radius: 6px;
width: 42px;
height: 50px;
padding-left: 14px;
padding-top: 16px;
}
.row-celeste {
height: 22%;
background-color: #8CE8FC;
}
<div class="container-flex">
<div class="left">
<div class="row">
<div class="col-md-7 col-md-offset-1 border-right">
<p class="card-text white-text">Mejorar clima en finanzas</p>
<h4 class="card-subtitle white-text">Ponderación 33%</h4>
</div>
<div class="col-md-4 check-area">
<p class="card-text white-text" id="clicker-calificacion"><i class="fa fa-check text-white" aria-hidden="true"></i> Calificar</p>
</div>
</div>
<div class="row-celeste">
<p class="card-text centered"></p>
</div>
</div>
<section class="main">
<a href="">
<div id="clicker-menu-black" class="col top"><i class="fa fa-bars white-text" aria-hidden="true"></i>
</div>
</a>
<a href="">
<div id="clicker" class="col middle"><i class="fa fa-plus white-text" aria-hidden="true"></i>
</div>
</a>
</section>
</div>
How can I make the light blue row stick to the bottom of ".left" regardless of its height? I've tried positioning, but perhaps I don't really understand it.
You need to use absolute positioning, see the example below:
.container-flex {
display: flex;
flex-flow: row;
height: 100px;
}
.left {
flex: 1;
background-color: #2C77A5;
padding-top: 2%;
border-top-left-radius: 6px;
height: 100px;
position: relative; /* must be set to the container of the absolute positioned element */
}
.main {
display: flex;
flex-direction: column;
}
.top {
background: #27698D;
border-bottom: 1px solid #2a2a2a;
border-top-right-radius: 6px;
width: 42px;
height: 50px;
padding-left: 14px;
padding-top: 14px;
}
.middle {
background: #27698D;
border-bottom-right-radius: 6px;
width: 42px;
height: 50px;
padding-left: 14px;
padding-top: 16px;
}
.row-celeste {
height: 22px;
background-color: #8CE8FC;
position: absolute; /* this will make your div position calculated respecting its container */
bottom: -19px; /* this will stick it to the bottom */
width: 100%;
z-index: -1;
}
<div class="container-flex">
<div class="left">
<div class="row">
<div class="col-md-7 col-md-offset-1 border-right">
<p class="card-text white-text">Mejorar clima en finanzas</p>
<h4 class="card-subtitle white-text">Ponderación 33%</h4>
</div>
<div class="col-md-4 check-area">
<p class="card-text white-text" id="clicker-calificacion"><i class="fa fa-check text-white" aria-hidden="true"></i> Calificar</p>
</div>
</div>
<div class="row-celeste">
<p class="card-text centered"></p>
</div>
</div>
<section class="main">
<a href="">
<div id="clicker-menu-black" class="col top"><i class="fa fa-bars white-text" aria-hidden="true"></i>
</div>
</a>
<a href="">
<div id="clicker" class="col middle"><i class="fa fa-plus white-text" aria-hidden="true"></i>
</div>
</a>
</section>
</div>
The light blue row doesn't need to be a div. It can be just a blue border
#box {
display: inline-flex;
flex-direction: row;
border-radius: 6px;
overflow: hidden;
}
#left {
background-color: #0073a9;
border-bottom: 10px solid #6aebff; /* Light blue "bar" */
display: flex;
flex-direction: row;
}
#left > * {
padding: 10px 20px;
}
#left > *:not(:first-child) {
border-left: 1px solid black;
}
#right {
background-color: #00688f;
display: flex;
flex-direction: column;
font-size: 22px;
font-weight: bold;
}
#right > * {
flex-grow: 1;
flex-basis: 0;
padding: 5px 10px;
text-align: center;
}
#right > *:not(:first-child) {
border-top: 1px solid black;
}
.centered-container {
display: flex;
direction: row;
justify-content: center;
align-items: center;
}
#ellipsis {
line-height: 30%;
}
* {
color: white;
}
#left {
font-family: sans, "Raleway";
}
<div id="box">
<div id="left">
<div id="title-div" class="centered-container">
<div>
<p><b>Mejorar políticas de liderazgo</b><br>Ponderación 40%</p>
</div>
</div>
<div id="qualify-div" class="centered-container">
✔ Calificar
</div>
</div>
<div id="right">
<div id="ellipsis" class="centered-container">
<div>·<br>·<br>·</div>
</div>
<div class="centered-container">
<div>+</div>
</div>
</div>
</div>
Is this OK?
<style>
.container-flex {
display: flex;
flex-flow: row;
height: 100px;
}
.left {
flex: 1;
background-color: #2C77A5;
padding-top: 2%;
border-top-left-radius: 6px;
height: 100px;
}
.main {
display: flex;
flex-direction: column;
}
.top {
background: #27698D;
border-bottom: 1px solid #2a2a2a;
border-top-right-radius: 6px;
width: 42px;
height: 50px;
padding-left: 14px;
padding-top: 14px;
}
.middle {
background: #27698D;
border-bottom-right-radius: 6px;
width: 42px;
height: 50px;
padding-left: 14px;
padding-top: 16px;
}
.row-celeste {
height: 22%;
background-color: #8CE8FC;
}
.row-celeste {
height: 22%;
background-color: #8CE8FC;
bottom: 0;
position: absolute;
width: 100%;
}
</style>
<div class="container-flex">
<div class="left">
<div class="row">
<div class="col-md-7 col-md-offset-1 border-right">
<p class="card-text white-text">Mejorar clima en finanzas</p>
<h4 class="card-subtitle white-text">Ponderación 33%</h4>
</div>
<div class="col-md-4 check-area">
<p class="card-text white-text" id="clicker-calificacion"><i class="fa fa-check text-white" aria-hidden="true"></i> Calificar</p>
</div>
</div>
<div class="row-celeste">
<p class="card-text centered"></p>
</div>
</div>
<section class="main">
<a href="">
<div id="clicker-menu-black" class="col top"><i class="fa fa-bars white-text" aria-hidden="true"></i>
</div>
</a>
<a href="">
<div id="clicker" class="col middle"><i class="fa fa-plus white-text" aria-hidden="true"></i>
</div>
</a>
</section>
</div>
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
hello the subject I couldn't do about css is this, how can i draw this in the image?
what I want to do is to copy the image with html and css.
I tried with display flex and but I couldn't
.channel-left {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
}
.channel-description {
width: auto !important;
}
<div class="channel-left mb-5">
<div class="channel-description">
<div class="channel-img">
<img src="img.jpg" class="img-circle">
</div>
<div class="channel-title">
<p>title</p>
<p>blabla</p>
</div>
</div>
<div class="channel-subs">
<button type="button" class="btn btn-large btn-outline-danger rounded"><i class="fa fa-heart"></i> Like</button>
</div>
</div>
.container {
display: flex;
background: black;
color: white;
align-items: center;
padding: 10px;
}
.description {
flex: 1 1 auto;
display: flex;
align-items: center;
}
.title {
padding: 10px;
}
.img {
border-radius: 90%;
overflow: hidden;
width: 50px;
height: 50px;
}
.subs {
flex: 0 1 auto;
}
<div class="container">
<div class="description">
<div class="img">
<img src="https://placekitten.com/50/50" class="img-circle">
</div>
<div class="title">
<p>title</p>
<p>blabla</p>
</div>
</div>
<div class="subs">
<button type="button" class="btn btn-large btn-outline-danger rounded">Like</button>
</div>
just give the simple flex css to parent, put all three items in same div and then give margin-left auto to last item to move it to right,
Rest style your typography and colors.
* {margin: 0; padding: 0; box-sizing: border-box;}
.channel-description {
display: flex;
align-items: center;
padding: 10px;
margin: 20px;
border: 1px solid #ddd;
}
.channel-subs {margin-left: auto;}
.channel-title {margin-left: 10px;}
<div class="channel-left mb-5">
<div class="channel-left mb-5">
<div class="channel-description">
<div class="channel-img">
<img src="img.jpg" class="img-circle">
</div>
<div class="channel-title">
<p>title</p>
<p>blabla</p>
</div>
<div class="channel-subs">
<button type="button" class="btn btn-large btn-outline-danger rounded"><i class="fa fa-heart"></i> Like</button>
</div>
</div>
</div>
Something like this would work:
.channel-left {
background: #1f2227;
border-radius: 15px;
color: white;
max-width: 400px;
padding-left: 20px;
padding-right: 20px;
}
.channel-left,
.channel-description {
display: flex;
align-items: center;
justify-content: center;
}
.channel-img {
flex-basis: 80px;
}
.channel-title,
.channel-description{
flex-basis: 100%;
}
<div class="channel-left mb-5">
<div class="channel-description">
<div class="channel-img">
<img src="img.jpg" class="img-circle">
</div>
<div class="channel-title">
<p>title</p>
<p>blabla</p>
</div>
</div>
<div class="channel-subs">
<button type="button" class="btn btn-large btn-outline-danger rounded"><i class="fa fa-heart"></i> Like</button>
</div>
</div>
I know you've already accepted an answer, however I want to post my own:
* {
font-family: sans-serif;
}
.channel-left {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
background: #222222;
padding-left: 10px;
padding-top: 10px;
border-radius: 10px;
}
.channel-description {
width: auto !important;
display: inherit;
flex-basis: 70%;
}
.img-circle {
border-radius: 50px;
border: 2px solid gray;
width: 50px;
}
.channel-info {
padding-left: 5px;
}
.btn-outline-danger {
background: #555555;
border-radius: 50px;
border: 2px solid gray;
height: 30px;
width: 150px;
color: white;
cursor: pointer;
margin-top: 25px;
}
.channel-subs {
display: inline-block;
float: right;
}
p {
color: white;
}
.channel-title {
font-weight: bold;
}
<div class="channel-left mb-5">
<div class="channel-description">
<div class="channel-img">
<img src="https://www.chiquita.com/wp-content/uploads/2019/12/Chiquita_Banana_Class_Extra_Yellow.jpg" class="img-circle">
</div>
<div class="channel-info">
<p class="channel-title">Title</p>
<p class="channel-desc">blabla</p>
</div>
</div>
<div class="channel-subs">
<button type="button" class="btn btn-large btn-outline-danger rounded"><i class="fa fa-heart"></i> Like</button>
</div>
</div>
hello I want to have a "how" when I go over the picture but the heart is positioned elsewhere. where is the mistake?
and the point I don't understand is why does my card width seem to be overflowing?
Because of the overflow I showed in the picture. When I add a card to the 2nd card. The cards are coming upside down.
.card-video {
width: 305px;
display: flex;
flex-direction: column;
}
.card-pic img {
object-fit: cover;
width: 100%;
height: 100%;
max-width: 305px;
max-height: 170px;
}
.card-info-logo {
position: absolute;
right: 5px;
top: -28px;
}
.card-info-logo img {
width: 55px;
border-radius: 50%;
border: 4px solid #5e4b55;
}
.card-info {
position: relative;
background-color: #292828;
height: 90px;
padding: 7px 10px 10px 10px;
display: flex;
flex-direction: column;
}
.card-info-top {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.card-info .card-info-category {
color: #546e7a;
font-size: 14px;
}
.card-info .card-info-title {
color: #546e7a;
font-size: 14px;
padding-bottom: 5px;
}
.card-info-bottom {
border-top: solid 1px #44393e;
padding-top: 7px;
display: flex;
align-items: center;
line-height: 1;
justify-content: space-between;
}
.card-info .card-info-bottom .views {
color: #546e7a;
font-size: 12px;
}
.card-info .card-info-bottom .date {
color: #546e7a;
font-size: 12px;
}
.card-pic {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
}
.clip-icon {
position: relative;
}
.clip-icon:hover {
background-color: red;
}
<div class="card-video">
<div class="card-pic">
<a href="">
<img src="https://i.ytimg.com/vi/VeDmG7YovSM/maxresdefault.jpg" alt="">
<div class="clip-icon">
<span class="fa fa-heart"></span>
</div>
</a>
</div>
<div class="card-info mt-1">
<div class="card-info-logo">
<img src="https://yt3.ggpht.com/a/AATXAJxBc7gQx7gKOeJG0uTgpfZVUA1FT_EOxjVjYtI-=s100-c-k-c0xffffffff-no-rj-mo" alt="">
</div>
<div class="card-info-top">
<div class="card-info-category">Video Category</div>
<div class="card-info-title">Video Title</div>
</div>
<div class="card-info-bottom">
<div class="views">312K</div>
<div class="date">16 hour ago</div>
</div>
</div>
</div>
.card-video is having flow direction column.
If you try to put the more card like this it will always show in upside down like a stack. Wrap the entire thing in div and provide the flow-direction: row and flex-wrap : wrap to get desired result.
<style>
.box{
display:flex;
flex-direction:row;
flex-wrap:wrap;
}
.card-video {
width: 305px;
display: flex;
flex-direction: column;
margin:0.5rem;
}
.card-pic img {
object-fit: cover;
width: 100%;
height: 100%;
max-width: 305px;
max-height: 170px;
}
.card-info-logo {
position: absolute;
right: 5px;
top: -28px;
}
.card-info-logo img {
width: 55px;
border-radius: 50%;
border: 4px solid #5e4b55;
}
.card-info {
position: relative;
background-color: #292828;
height: 90px;
padding: 7px 10px 10px 10px;
display: flex;
flex-direction: column;
}
.card-info-top {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.card-info .card-info-category {
color: #546e7a;
font-size: 14px;
}
.card-info .card-info-title {
color: #546e7a;
font-size: 14px;
padding-bottom: 5px;
}
.card-info-bottom {
border-top: solid 1px #44393e;
padding-top: 7px;
display: flex;
align-items: center;
line-height: 1;
justify-content: space-between;
}
.card-info .card-info-bottom .views {
color: #546e7a;
font-size: 12px;
}
.card-info .card-info-bottom .date {
color: #546e7a;
font-size: 12px;
}
.card-pic {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
}
.clip-icon {
position: relative;
}
.clip-icon:hover {
background-color: red;
}
</style>
<div class="box">
<div class="card-video">
<div class="card-pic">
<a href="">
<img src="https://i.ytimg.com/vi/VeDmG7YovSM/maxresdefault.jpg" alt="">
<div class="clip-icon">
<span class="fa fa-heart"></span>
</div>
</a>
</div>
<div class="card-info mt-1">
<div class="card-info-logo">
<img src="https://yt3.ggpht.com/a/AATXAJxBc7gQx7gKOeJG0uTgpfZVUA1FT_EOxjVjYtI-=s100-c-k-c0xffffffff-no-rj-mo" alt="">
</div>
<div class="card-info-top">
<div class="card-info-category">Video Category</div>
<div class="card-info-title">Video Title</div>
</div>
<div class="card-info-bottom">
<div class="views">312K</div>
<div class="date">16 hour ago</div>
</div>
</div>
</div>
<div class="card-video">
<div class="card-pic">
<a href="">
<img src="https://i.ytimg.com/vi/VeDmG7YovSM/maxresdefault.jpg" alt="">
<div class="clip-icon">
<span class="fa fa-heart"></span>
</div>
</a>
</div>
<div class="card-info mt-1">
<div class="card-info-logo">
<img src="https://yt3.ggpht.com/a/AATXAJxBc7gQx7gKOeJG0uTgpfZVUA1FT_EOxjVjYtI-=s100-c-k-c0xffffffff-no-rj-mo" alt="">
</div>
<div class="card-info-top">
<div class="card-info-category">Video Category</div>
<div class="card-info-title">Video Title</div>
</div>
<div class="card-info-bottom">
<div class="views">312K</div>
<div class="date">16 hour ago</div>
</div>
</div>
</div>
</box>
The flex-direction needs to be set to row, with flex-wrap:wrap as to format correctly.
The .clip-icon can be set to position:absolute if the parent element has position:relative applied.
You can set the clip-icon to display:none and get it to display on picture hover by adding .card-pic:hover .clip-icon: { display:block; }
I have added a snippet below
.box{
display:flex;
flex-direction:row;
flex-wrap:wrap;
}
.card-video {
width: 305px;
display: flex;
flex-direction: column;
margin:0.5rem;
}
.card-pic img {
object-fit: cover;
width: 100%;
height: 100%;
max-width: 305px;
max-height: 170px;
}
.card-info-logo {
position: absolute;
right: 5px;
top: -28px;
}
.card-info-logo img {
width: 55px;
border-radius: 50%;
border: 4px solid #5e4b55;
}
.card-info {
position: relative;
background-color: #292828;
height: 90px;
padding: 7px 10px 10px 10px;
display: flex;
flex-direction: column;
}
.card-info-top {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.card-info .card-info-category {
color: #546e7a;
font-size: 14px;
}
.card-info .card-info-title {
color: #546e7a;
font-size: 14px;
padding-bottom: 5px;
}
.card-info-bottom {
border-top: solid 1px #44393e;
padding-top: 7px;
display: flex;
align-items: center;
line-height: 1;
justify-content: space-between;
}
.card-info .card-info-bottom .views {
color: #546e7a;
font-size: 12px;
}
.card-info .card-info-bottom .date {
color: #546e7a;
font-size: 12px;
}
.card-pic:hover .clip-icon{
display:block;
}
.card-pic {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
list-style: none;
position:relative;
}
.clip-icon a {
position: relative
}
.clip-icon {
position: absolute;
bottom:10px;
left:5px;
width:20px;
height:20px;
background-color:white;
display:none;
}
.clip-icon:hover {
background-color: red;
}
<div class="box">
<div class="card-video">
<div class="card-pic">
<a href="">
<img src="https://i.ytimg.com/vi/VeDmG7YovSM/maxresdefault.jpg" alt="">
<div class="clip-icon">
<span class="fa fa-heart"></span>
</div>
</a>
</div>
<div class="card-info mt-1">
<div class="card-info-logo">
<img src="https://yt3.ggpht.com/a/AATXAJxBc7gQx7gKOeJG0uTgpfZVUA1FT_EOxjVjYtI-=s100-c-k-c0xffffffff-no-rj-mo" alt="">
</div>
<div class="card-info-top">
<div class="card-info-category">Video Category</div>
<div class="card-info-title">Video Title</div>
</div>
<div class="card-info-bottom">
<div class="views">312K</div>
<div class="date">16 hour ago</div>
</div>
</div>
</div>
<div class="card-video">
<div class="card-pic">
<a href="">
<img src="https://i.ytimg.com/vi/VeDmG7YovSM/maxresdefault.jpg" alt="">
<div class="clip-icon">
<span class="fa fa-heart"></span>
</div>
</a>
</div>
<div class="card-info mt-1">
<div class="card-info-logo">
<img src="https://yt3.ggpht.com/a/AATXAJxBc7gQx7gKOeJG0uTgpfZVUA1FT_EOxjVjYtI-=s100-c-k-c0xffffffff-no-rj-mo" alt="">
</div>
<div class="card-info-top">
<div class="card-info-category">Video Category</div>
<div class="card-info-title">Video Title</div>
</div>
<div class="card-info-bottom">
<div class="views">312K</div>
<div class="date">16 hour ago</div>
</div>
</div>
</div>
</box>
.circle{
padding:20px !important;
}
h2{
margin:unset;
}
.circle-text {
display: block;
margin: auto;
height: 120px;
width: 120px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background: #FF9800 ;
color: #fff;
font: 18px "josefin sans", arial;
line-height: 120px;
}
.a {
display: inline-block;
position: relative;
}
.a:before,
.a:after {
content: "";
position: absolute;
height: 60px;
border-bottom: 5px solid black;
top:0;
width: 293px;
}
.a:before {
right: 100%;
margin-right: 0px;
}
.a:after {
left: 100%;
margin-left:0px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<div class="uk-section-align uk-margin-xlarge-top">
<div class="uk-container">
<div class="uk-text-center" uk-grid>
<div class="uk-width-1-3 circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 ">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</div>
I want to make responsive progress bar using pure css and uikit 3. This code i was written it works when it show in desktop mode . when i switching desktop mode to mobile mode , middle black line strike both circle. i just want to when it show in mobile mode also it only touch the circle.
please give some suggestion.
Try this
.circle{
padding:20px !important;
}
h2{
margin:unset;
}
.circle-text {
display: block;
margin: auto;
height: 120px;
width: 120px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background: #FF9800 ;
color: #fff;
font: 18px "josefin sans", arial;
line-height: 120px;
}
.a {
display: inline-block;
position: relative;
}
/*
.a:before,
.a:after {
content: "";
position: absolute;
height: 60px;
border-bottom: 5px solid black;
top:0;
width: 293px;
}
.a:before {
right: 100%;
margin-right: 0px;
}
.a:after {
left: 100%;
margin-left:0px;
}
*/
.uk-process-step {
position: relative;
}
.uk-process-step:before {
top: 60px;
bottom: 0;
position: absolute;
content: " ";
width: 100%;
height: 5px;
background-color: black;
}
.uk-process-step .uk-width-1-3 {
position: relative;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<div class="uk-section-align uk-margin-xlarge-top">
<div class="uk-container">
<div class="uk-text-center uk-process-step" uk-grid>
<div class="uk-width-1-3 circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 ">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</div>
Use z-index for the pseudo elements (the black line).
Set it to -1 so that it will go beyond the circle.
Try this
.circle{
padding:20px !important;
}
h2{
margin:unset;
}
.circle-text {
display: block;
margin: auto;
height: 120px;
width: 120px;
text-align: center;
vertical-align: middle;
border-radius: 50%;
background: #FF9800 ;
color: #fff;
font: 18px "josefin sans", arial;
line-height: 120px;
}
.a {
display: inline-block;
position: relative;
}
.a:before,
.a:after {
content: "";
position: absolute;
height: 60px;
border-bottom: 5px solid black;
top:0;
width: 293px;
}
.a:before {
right: 100%;
margin-right: 0px;
z-index: -1;
}
.a:after {
left: 100%;
margin-left:0px;
z-index:-1
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.25/css/uikit.min.css" rel="stylesheet"/>
<div class="uk-section-align uk-margin-xlarge-top">
<div class="uk-container">
<div class="uk-text-center" uk-grid>
<div class="uk-width-1-3 circle">
<div class="circle-text ">
<i class="medium material-icons">Step 1</i>
</div>
<p class="center-align uk-margin-top">Choose Your Trip</p>
</div>
<div class="uk-width-1-3 ">
<div class="circle-text a">
<i class="medium material-icons">Step 2</i>
</div>
<p class="center-align uk-margin-top ">Request for reservation</p>
</div>
<div class="uk-width-1-3">
<div class="circle-text ">
<i class="medium material-icons">Step 3</i>
</div>
<p class="center-align uk-margin-top">Successfully</p>
</div>
</div>
</div>
</div>
I'm using Bootstrap 3.3.7 and Angular 5.2.0. I have a loop with the addition of a new entry. Entries are added to "cards". But the problem is that they are now added vertically. And how can I make it so that they are added all along the horizontally by about 5 "cards" in a row as a new record is added ie 6 was transferred to a new row.
html and all css on the cards: :
.card{
display: inline-block;
position: relative;
width: 100%;
margin: 25px 0;
box-shadow: 0 1px 4px 0 rgba(0,0,0,0.14);
border-radius: $border-radius-base;
color: $mdb-card-body-text;
background: $mdb-card-body-background;
.card-height-indicator {
margin-top: 100%;
}
.title{
margin-top: 0;
margin-bottom: 5px;
}
.card-image {
height: 60%;
position: relative;
overflow: hidden;
margin-left: 15px;
margin-right: 15px;
margin-top: -30px;
border-radius: $border-radius-large;
img {
width: 100%;
height: 100%;
border-radius: $border-radius-large;
pointer-events: none;
}
.card-title {
position: absolute;
bottom: 15px;
left: 15px;
color: $mdb-card-image-headline;
font-size: $font-size-h4;
text-shadow: 0 2px 5px rgba(33, 33, 33, 0.5);
}
}
.category:not([class*="text-"]){
color: $gray-color;
}
.card-content{
padding: 15px 20px;
.category{
margin-bottom: 0;
}
}
.card-header{
#include shadow-big();
margin: -20px $margin-base 0;
border-radius: $border-radius-base;
padding: $padding-base;
background-color: $gray-color;
.title{
color: $white-color;
}
.category{
margin-bottom: 0;
color: rgba($white-color, .62);
}
&.card-chart{
padding: 0;
min-height: 160px;
+ .content{
h4{
margin-top: 0;
}
}
}
.ct-label{
color: rgba($white-color, .7);
}
.ct-grid{
stroke: rgba(255, 255, 255, 0.2);
}
.ct-series-a .ct-point,
.ct-series-a .ct-line,
.ct-series-a .ct-bar,
.ct-series-a .ct-slice-donut{
stroke: rgba(255,255,255,.8);
}
.ct-series-a .ct-slice-pie,
.ct-series-a .ct-area{
fill: rgba(255,255,255,.4);
}
}
.chart-title{
position: absolute;;
top: 25px;
width: 100%;
text-align: center;
h3{
margin: 0;
color: $white-color;
}
h6{
margin: 0;
color: rgba(255,255,255, .4);
}
}
.card-footer{
margin: 0 20px 10px;
padding-top: 10px;
border-top: 1px solid #eeeeee;
.content{
display: block;
}
div{
display: inline-block;
}
.author{
color: $gray-color;
}
.stats{
line-height: 22px;
color: $gray-color;
font-size: $font-size-small;
.material-icons{
position: relative;
top: 4px;
font-size: $font-paragraph;
}
}
h6{
color: $gray-color;
}
}
img{
width: 100%;
height: auto;
}
.category{
.material-icons{
position: relative;
top: 6px;
line-height: 0;
}
}
.category-social{
.fa{
font-size: 24px;
position: relative;
margin-top: -4px;
top: 2px;
margin-right: 5px;
}
}
.author{
.avatar{
width: 30px;
height: 30px;
overflow: hidden;
border-radius: 50%;
margin-right: 5px;
}
a{
color: $black-color;
text-decoration: none;
.ripple-container{
display: none;
}
}
}
.table{
margin-bottom: 0;
tr:first-child td{
border-top: none;
}
}
[data-background-color="purple"]{
background: linear-gradient(60deg, $purple-400, $purple-600);
#include shadow-big-color($brand-primary);
}
[data-background-color="blue"]{
background: linear-gradient(60deg, $blue-900, $blue-900);
#include shadow-big-color($brand-info);
}
[data-background-color="green"]{
background: linear-gradient(60deg, $green-400, $green-600);
#include shadow-big-color($brand-success);
}
[data-background-color="orange"]{
background: linear-gradient(60deg, $orange-400, $orange-600);
#include shadow-big-color($brand-warning);
}
[data-background-color="red"]{
background: linear-gradient(60deg, $red-400, $red-600);
#include shadow-big-color($brand-danger);
}
[data-background-color]{
color: $white-color;
a{
color: $white-color;
}
}
}
.card-stats{
.title{
margin: 0;
}
.card-header{
float: left;
text-align: center;
i{
font-size: 36px;
line-height: 56px;
width: 56px;
height: 56px;
}
}
.card-content{
text-align: right;
padding-top: 10px;
}
}
.card-nav-tabs{
.header-raised{
margin-top: -$margin-base * 2;
}
.nav-tabs{
background: transparent;
padding: 0;
}
.nav-tabs-title{
float: left;
padding: 10px 10px 10px 0;
line-height: 24px;
}
}
.card-plain{
background: transparent;
box-shadow: none;
.card-header{
margin-left: 0;
margin-right: 0;
}
.content{
padding-left: 5px;
padding-right: 5px;
}
.card-image{
margin: 0;
border-radius: $border-radius-base;
img{
border-radius: $border-radius-base;
}
}
}
.iframe-container{
margin: 0 -20px 0;
iframe{
width: 100%;
height: 500px;
border: 0;
#include shadow-big();
}
}
.card-profile,
.card-testimonial{
margin-top: 30px;
text-align: center;
.btn-just-icon.btn-raised{
margin-left: 6px;
margin-right: 6px;
}
.card-avatar{
max-width: 130px;
max-height: 130px;
margin: -50px auto 0;
border-radius: 50%;
overflow: hidden;
#include shadow-big();
& + .content{
margin-top: 15px;
}
}
&.card-plain{
.card-avatar{
margin-top: 0;
}
}
}
<div class="col-lg-3 col-md-6 col-sm-6">
<div *ngFor="let note of notes" >
<div class="card-header" data-background-color="blue">
<i class="material-icons">store</i>
</div>
<div class="card-content" >
<p class="category">{{note.name}} </p>
</div>
<div class="card-footer">
<div class="stats">
<button class="button-save" ><i class="fa fa-eye"></i></button>
<button class="button-trash" ><i class="fa fa-trash"></i></button>
</div>
</div>
</div>
</div>
Add the *ngFor on the following element
<div class="col-lg-3 col-md-6 col-sm-6" *ngFor="let note of notes">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-6" *ngFor="let note of notes">
<div class="card-header" data-background-color="blue">
<i class="material-icons">store</i>
</div>
<div class="card-content">
<p class="category">{{note.name}} </p>
</div>
<div class="card-footer">
<div class="stats">
<button class="button-save"><i class="fa fa-eye"></i></button>
<button class="button-trash"><i class="fa fa-trash"></i></button>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6" *ngFor="let note of notes">
<div class="card-header" data-background-color="blue">
<i class="material-icons">store</i>
</div>
<div class="card-content">
<p class="category">{{note.name}} </p>
</div>
<div class="card-footer">
<div class="stats">
<button class="button-save"><i class="fa fa-eye"></i></button>
<button class="button-trash"><i class="fa fa-trash"></i></button>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6" *ngFor="let note of notes">
<div class="card-header" data-background-color="blue">
<i class="material-icons">store</i>
</div>
<div class="card-content">
<p class="category">{{note.name}} </p>
</div>
<div class="card-footer">
<div class="stats">
<button class="button-save"><i class="fa fa-eye"></i></button>
<button class="button-trash"><i class="fa fa-trash"></i></button>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6" *ngFor="let note of notes">
<div class="card-header" data-background-color="blue">
<i class="material-icons">store</i>
</div>
<div class="card-content">
<p class="category">{{note.name}} </p>
</div>
<div class="card-footer">
<div class="stats">
<button class="button-save"><i class="fa fa-eye"></i></button>
<button class="button-trash"><i class="fa fa-trash"></i></button>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6" *ngFor="let note of notes">
<div class="card-header" data-background-color="blue">
<i class="material-icons">store</i>
</div>
<div class="card-content">
<p class="category">{{note.name}} </p>
</div>
<div class="card-footer">
<div class="stats">
<button class="button-save"><i class="fa fa-eye"></i></button>
<button class="button-trash"><i class="fa fa-trash"></i></button>
</div>
</div>
</div>
</div>
</div>
You need to modify the Bopotstrap grid structure to incorporate 5 columns in a row. Try using the following structure, you will be able to get what you want.
.col.col-2 {
flex: 0 0 20%;
max-width: 20%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col col-2">
1 columns
</div>
<div class="col col-2">
2 columns
</div>
<div class="col col-2">
3 columns
</div>
<div class="col col-2">
4 columns
</div>
<div class="col col-2">
5 columns
</div>
<div class="col col-2">
6 columns
</div>
</div>
</div>
I have recent-posts div that show two post with their images and text. after recent-posts I have another div contact-us that contain an image and some text. My issue appear in extra-small size where recent-posts posts go under contact-us part. How can I fix that? The following is my codes and JsFiddle.
HTML:
<div id="recent-posts" class="center-block row">
<div class="posts col-md-3 col-sm-5 col-xs-9">
<div class="posts-div">
<div class="img-hover">
<img src="images/post1.jpg" class="img-responsive">
<div class="overlay col-md-12 col-xs-12">
<div>
<span class="fa fa-2x fa-square post-icon" ><span class="fa fa-heart"></span></span>
<span class="fa fa-2x fa-square post-icon" ><span>16</span></span>
</div>
<div>
<span class="fa fa-2x fa-square post-icon" ><span class="fa fa-eye"></span></span>
<span class="fa fa-2x fa-square post-icon" ><span>16</span></span>
</div>
</div>
</div>
<p class="text-center">dsfdsfsdfldshfdskfhdsf</div>
</div>
<div class="posts col-md-3 col-sm-5 col-xs-9">
<div class="posts-div">
<div class="img-hover">
<img src="images/post2.jpg" class="img-responsive">
<div class="overlay col-md-12 col-xs-12">
<div>
<span class="fa fa-2x fa-square post-icon" ><span class="fa fa-heart "></span></span>
<span class="fa fa-2x fa-square post-icon" ><span>16</span></span>
</div>
<div>
<span class="fa fa-2x fa-square post-icon" ><span class="fa fa-eye "></span></span>
<span class="fa fa-2x fa-square post-icon" ><span>16</span></span>
</div>
</div>
</div>
<p class="text-center">dsjkfhjdssafjsdkjhfdsf</p>
</div>
</div>
</div>
<div id="contact-us" class="row">
<div class="col-md-12 col-xs-12">
<img src="http://www.infocurse.com/wp-content/uploads/2014/11/716988156_1368083660.png" class="img-responsive">
<div id="contact-us-text">
<p>sdkf,sd,kfnds,nf,d.....</p>
<p>kdsfnks,dnf,ksdnf,kdsnf,kdsnf,d</p>
<button class="btn btn-success pull-left">124234234</button>
</div>
</div>
</div>
Css:
#recent-posts{
height: 350px;
display: flex;
justify-content: center;
position: relative;
flex-wrap: wrap;
margin-bottom: 100px;
}
.posts{
display: flex;
flex-direction: column;
height: 350px;
margin-top: 20px;
position: relative;
border-radius: 5px;
box-shadow: 1px 1px 5px #888888;
padding: 0;
margin-left: 20px;
margin-right: 20px;
}
.posts img{
border-radius: 5px 5px 0 0;
cursor: pointer;
}
.posts .btn-success{
position: absolute;
background-color: #01a89e;
width: 50%;
color: #101010;
cursor: auto;
margin-top: -17px;
margin-right: 25%;
}
.posts .btn-success:active{
background-color: #01a89e;
color: #101010;
box-shadow: none;
}
.posts p{
margin-top: 30px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.overlay {
position: absolute;
top: 0;
bottom: 100%;
left: 0;
right: 0;
background-color: rgba(46, 183, 175, .7);
overflow: hidden;
height:0;
transition: .8s ease;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
border-radius: 5px 5px 0 0;
}
.overlay div:first-child{
margin-left: 15px;
}
.posts-div:hover .overlay {
bottom: 0;
top: 0;
height: auto;
overflow: hidden;
}
.img-hover{
position: relative;
}
.post-icon{
color: rgba(255, 255, 255, 1);
transform: rotate(45deg);
opacity: 1;
}
.post-icon span{
transform: rotate(-45deg);
font-size: 12px;
position: absolute;
left: 50%;
top: 0.6em;
margin-left: -7px;
color: #101010;
font-weight: bold;
}
.fa-heart{
color: red !important;
}
#contact-us{
height: 200px;
margin-bottom: 30px;
box-shadow: 0 1px 5px #666666, 0 -1px 5px #666666;
position: relative;
padding: 0;
overflow: hidden;
}
#contact-us-text{
position: absolute;
top: 20%;
left: 12%;
}
#contact-us-text p{
color: white;
}
#contact-us-text .btn-success{
background-color: #01a89e;
cursor: auto;
}
#contact-us-text .btn-success:active{
background-color: #01a89e;
box-shadow: none;
}
JsFiddle
Recent-posts class has a fixed height.
#recent-posts{
height: 350px; // THIS LINE IS THE REASON!
display: flex;
justify-content: center;
position: relative;
flex-wrap: wrap;
margin-bottom: 100px;
}
Updated fiddle