cards not aligning correctly - html

Im trying to display cards in two columns but the cards are not aligning correctly, the top of the card on the right is displaying at the bottom of the column. id like for the cards to be aligned horizontally by the top of each card
img {
width: 269px;
height: 402px;
}
.card-block{
margin: 20px;
}
.btn-dark{
width: 120px;
border-radius: 3px;
}
<div class="container" style="column-count: 2; margin-top: 100px;">
<div class="row">
<div class="col-sm-14 mx-auto">
<div *ngFor="let book of webService.book_list | async">
<div class="card bg-light mb-5 mr-5" [routerLink]="['/books', book._id]" style="cursor: pointer">
<div class="card-header">
<strong>{{book.title}}</strong> by <strong>{{book.author}}</strong>
</div>
<div class="row no-gutters">
<div class="col-auto">
<img [src]="book.imageLink" />
</div>
<div class="col">
<div class="card-block">
<strong>Country of Origin:</strong> {{book.country}} <br />
<strong>Year Released:</strong> {{book.year}} <br />
<strong>Language: </strong> {{book?.language}} <br />
<strong>Pages: </strong> {{book?.pages}}
</div>
</div>
</div>
<div class="card-footer">
<strong>{{book.review_count}}</strong>
review(s) available <br>
</div>
</div>
</div>
</div>
</div>
</div>

Related

How can I create a Bootstrap grid layout with a responsive but minimum width left column and scrollable right column?

I am close to achieving this look and behavior but I am having issues with the scrolling of the right column. The scroll bar appears but does not scroll the content on the right column. Should look like this:
.
Currently looks like this:
There are probably multiple approaches or changes I can take or make but any suggestions are welcome! Code is provided below.
.scroller {
overflow-x: scroll;
white-space: nowrap;
}
.row {
display: flex;
flex-wrap: nowrap;
}
.col-md-4 {
min-width: 240px;
}
.col-md-8 {
flex-grow: 1;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="row">
<div class="col-4" style="min-width: 240px;">
<div class="row pb-1">
<div class="col-3 offset-3">
<b>NAME</b>
</div>
</div>
<div class="row row-striped align-items-center pb-1 pt-1">
<div class="col-3">
<img src="https://media.api-sports.io/football/players/730.png" alt="player photo" width="40px" height="40px">
</div>
<div class="col-9 player-table-text">
<div>
Thibaut Courtois
<span class="ps-1 player-number-text">1</span>
</div>
</div>
</div>
</div>
<div class="col scroller" style="min-width: 500px;">
<div class="row pb-1">
<div class="col-2 offset-1">
<b>POS</b>
</div>
<div class="col-2">
<b>AGE</b>
</div>
<div class="col-2">
<b>HT</b>
</div>
<div class="col-2">
<b>WT</b>
</div>
<div class="col-2">
<b>NAT</b>
</div>
</div>
<div class="row row-striped align-items-center pb-1 pt-1 player-table-text" style="height:48px;">
<div class="col-2 offset-1">
GK
</div>
<div class="col-2">
30
</div>
<div class="col-2">
6' 7"
</div>
<div class="col-2">
212 lbs
</div>
<div class="col-2">Belgium</div>
</div>
</div>
</div>

Unable to make Bootstrap columns of equal height

I using Bootstrap4 for my personal website and I am not able to make the columns of equal height.
I have looked for solutions here but the solutions don't seem to work on my code. I would appreciate any input.
<!-- Start projects section--->
<div id="projects" class="offset">
<!--- start jumbotron -->
<div class="jumbotron">
<div class="col-12 text-center">
<h3 class="heading">Projects</h3>
<div class="heading-underline"></div>
</div>
<div class="row">
<div class="col-md-6 projects">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8 text-left">
<h5 class="heading project-title">The Twitter Bakery (2018) </h5>
</div>
</div>
<div class="row">
<div class="col-md-4">
<!--- image of client -->
<img src="img/mountains_trip.jpg" alt="image not displayed">
</div>
<div class="col-md-8">
<!--- text of client -->
<div>
Some words<br><br>Some more words
</div>
<hr class="projects-hr">
<i class="fab fa-github fa-2x"></i>
</div>
</div>
</div>
<div class="col-md-6 projects">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8 text-left">
<h5 class="heading project-title">Jersey Allocation (2018)</h5>
</div>
</div>
<div class="row">
<div class="col-md-4">
<!--- image of client -->
<img src="img/mountains_trip.jpg" alt="image not displayed">
</div>
<div class="col-md-8">
<!--- text of client -->
<div>
Some words.
</div>
<hr class="projects-hr">
<i class="fab fa-github fa-2x"></i>
</div>
</div>
</div>
</div>
</div>
<!--- end jumbotron -->
</div>
<!-- end projects section--->
Here is my css for the section. The (.row and [class*="col-"]) rules are copied from the answers presented in the above link.
.row{
overflow: hidden;
}
[class*="col-"]{
margin-bottom: -99999px;
padding-bottom: 99999px;
}
.projects img{
width:100%;
border-radius:10%;
}
.projects hr{
border-top:0.05rem solid #ad7232!important;
padding-bottom: 0.1rem;/* makes them visible in some cases*/
}
.project-link .svg-inline--fa{
align-self: center;
color: #505962 ;
}
.project-title{
text-transform: uppercase;
color: #ed9a00;
}
This is how the current section looks

How to get desired html layout in small screens which is differ in large screens

I implemented markup code and got desired layout in large screens, but on reducing size of screen to the phone level I need layout like image-3 and in big screen like laptops it should be like image-1. Image-1,Image-3 refer to single image that i have linked.
I am using Bootstrap-4, html-5
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<h6>Image-1 in large screens like laptop</h6>
<div class="row">
<div class="col-sm-8 ">
<div class=" card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-sm-4">
<div class="card"><button class="bg-danger" style="padding: 10%; font-size: 15px">oneSmall</button></div>
<div class="card"><button class="bg-danger" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
</div>
</div>
<!-- In order to fulfil desired layoutin small screens, i implemented this-->
<div class="container-fluid">
<h6>Image-2 after i made changes to get layout like Image-3,but in large screen it looks</h6>
<div class="row">
<div class="col-sm-8 col-12 ">
<div class=" card">
<button class="bg-dark" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-sm-4">
<div class="row">
<div class="card col-6"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
<div class="card col-6"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<h6>Image-3, like this i need to get in phone's screen, or smaller devices</h6>
<div class="row">
<div class="col-12">
<div class=" card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="card col-6"><button class="bg-danger" style="padding-right: 50%; padding-bottom: 10%; font-size: 15px; width: 100%">oneSmall</button></div>
<div class="card col-6"><button class="bg-danger" style="padding-left: 50%; padding-bottom: 10%;font-size: 15px; width: 100%">oneSmall</button></div>
</div>
</div>
Image that describes layout
Use the responsive grid classes to change the layout at the desired breakpoints.
For example, col-12 col-md-8 means 8 columns wide on md and larger, and 12 columns wide on md and smaller:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-8">
<div class=" card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-12 col-md-4">
<div class="row h-100">
<div class="col-6 col-md-12">
<div class="card h-100">
<button class="bg-danger h-100" style="padding-right: 50%; padding-bottom: 10%; font-size: 15px; width: 100%">oneSmall</button>
</div>
</div>
<div class="col-6 col-md-12">
<div class="card h-100">
<button class="bg-danger h-100" style="padding-right: 50%; padding-bottom: 10%; font-size: 15px; width: 100%">oneSmall</button>
</div>
</div>
</div>
</div>
</div>
</div>
https://www.codeply.com/go/eTGcVjgAWH
Try with this code. Hope can help you.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-lg-8 col-sm-12">
<div class="card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-lg-4 col-sm-12">
<div class="row">
<div class="col-md-12 col-sm-6">
<div class="card"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
<div class="col-md-12 col-sm-6">
<div class="card"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
</div>
</div>
</div>
</div>

How to make the left and right border of a card in ionic transparent

The below is my HTML. I have a total of 3 cards in three columns and want only the left and right side to be transparent. I have tried setting border to white/transparent but no success.
. What I want
.user-panel .card {
margin-top: 1px;
}
.user-panel {
min-height: 170px;
}
.user-panel,
.user-panel .card {
display: flex;
height: 100%;
}
.user-panel,
.user-panel .card .item {
height: inherit;
text-align: center;
}
.user-panel .user-profile-details .item {
background-color: #edfaff;
}
<div class="row no-padding user-panel">
<div class="col col-33 no-padding">
<div class="card no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div class="row"><i class="user-profile-icon"></i> </div>
<div>{{data}}</div>
<div>(015106)</div>
</div>
</span>
</div>
</div>
</div>
<div class="col col-33 no-padding">
<div class="card no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div>MY ACCESSES</div>
</div>
</span>
</div>
</div>
</div>
<div class="col col-33 no-padding">
<div class="card no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div>MY ACCESSES</div>
</div>
</span>
</div>
</div>
</div>
</div>
why do u use card. Just give some custom class name and define css for that. Something Like below would work without flaws.
<div class="col col-33 no-padding">
<div class="card-access no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div>MY ACCESSES</div>
</div>
</span>
</div>
</div>
</div>
.user-panel .card {
border: 1px solid #ccc;
//remove this
}
//add this
.bordered-col {
border-right : 1px solid #ccc;
}
<div class="row no-padding user-panel">
<div class="bordered-col col col-33 no-padding">
<div class="card no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div class="row"><i class="user-profile-icon"></i> </div>
<div>{{data}}</div>
<div>(015106)</div>
</div>
</span>
</div>
</div>
</div>
<div class="col col-33 no-padding">
<div class="card no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div>MY ACCESSES</div>
</div>
</span>
</div>
</div>
</div>
<div class="col col-33 no-padding">
<div class="card no-padding">
<div class="item item-text-wrap">
<span>
<div>
<div>MY ACCESSES</div>
</div>
</span>
</div>
</div>
</div>
</div>
Try to add a class in each MY ACCESS e.g. <div class="access1">MY ACCESS</div> and <div class="access2">MY ACCESS</div> then add this css styles:
.no-padding > span > .access1{
border-right: 0;
}
.no-padding > span > .access2{
border-left: 0;
}
Please include your css styles too, so we can figure your problem. Leave a comment if it doesn't work.

Same height in row?

How can I use the same height in row that keeps the site responsive? For example I have two x_panel with rows and columns inside but the height is different, i tried use display flex, but it change inside columns...
Here is a code to you understand what I'm trying to do:
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="x_panel tile">
<div class="x_content">
<div class="row x_title">
<h3>Ponto de Venda:<small id="node_name"></small></h3>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="col-md-5 col-sm-5 col-xs-12">
<h5>Período de Avaliação:</h5>
</div>
<div class="col-md-7 col-sm-7 col-xs-12">
<div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 100%; text-align: center; border: 1px solid #ccc">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
<span id="grafico_medias"></span> <b class="caret"></b>
</div>
</div>
</div>
</div>
<div class="row tile_count text-center">
<div class="col-md-4 col-sm-12 col-xs-12 tile_stats_count">
<span class="count_top"><i class="fa fa-user"></i> Total de Pedestres</span>
<div id="displayPedestres" class="count"></div>
</div>
<div class="col-md-4 col-sm-12 col-xs-12 tile_stats_count">
<span class="count_top"><i class="fa fa-eye"></i> Visualizações</span>
<div id="displayInteracoes" class="count"></div>
</div>
<div class="col-md-4 col-sm-12 col-xs-12 tile_stats_count">
<span class="count_top"><i class="fa fa-refresh"></i> Taxa de Conversão</span>
<div id="displayTaxa" class="count green"></div>
</div>
</div>
</div>
</div>
</div>
<!-- /Informacoes medias -->
<!-- Meta -->
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="x_panel tile">
<div class="x_content">
<div class="row x_title">
<h3>Meta</h3>
</div>
<div class="col-md-7 col-sm-12 col-xs-12">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-6">
<h5>Meta do</h5>
</div>
<div class="col-md-9 col-sm-6 col-xs-6" style="text-align: right">
<select id="metaPeriodo" onchange="meta()" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 100%; text-align: center; border: 1px solid #ccc">
<option>dia</option>
<option>mês</option>
<option>trimestre</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-6">
<h5>em</h5>
</div>
<div class="col-md-9 col-sm-6 col-xs-6" style="text-align: right">
<select id="metaVariavel" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 100%; text-align: center; border: 1px solid #ccc" id="tipo_meta" onclick="meta()">
<option>pedestres</option>
<option>visualizações</option>
<option>taxa de conversão</option>
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<input id="metaInput" type="text" class="form-control has-feedback" placeholder="Insira aqui a meta" style="height: 68px; font-size: 40px; font-weight: 600; color: #73879C; text-align: center">
</div>
</div>
</div>
<div class="col-md-5 col-sm-12 col-xs-12">
<div class="row">
<div class="sidebar-widget text-center">
<h4 style="text-align: center;">Cumprimento da Meta</h4>
<canvas width="140" height="80" id="foo" class="" style="width: 150px; height: 100px;"></canvas>
<div class="goal-wrapper" style="text-align: center;">
<span class="gauge-value pull-center"></span>
<span id="gauge-text" class="gauge-value pull-center"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /Meta -->
</div>
I would like to "sync" this two columns with the same height doesn't matter the size of screen, can you help me?
EDIT
fiddle: https://jsfiddle.net/5nzcpj3s/
I am using Bootstrap with gentelella layout
https://jsfiddle.net/frd28kk0
I added new CSS classes just to make it easier to understand.
You have to play with the margins to get it better.
Your flexbox idea was fine. I guess you only missed setting .so-col-1 as display: flex; as well.
Boa sorte! =]
with flex-box and adding a single css class:
<div class="row flexit">...</div>
.flexit {
display:flex;
}
.flexit > div {
flex:1;
}
codepen example