Same height in row? - html

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

Related

How to set borders in CSS correctly without crossing on next div?

I have problem setting up borders on columns. Text is changing size of div so the border change. I have tried to set fixed size of divs but it wasn't good. I am not sure why are borders moving. Is it for padding? I am beginner and its hard for me to get it right way. Hoe to make it fixed, without crossing to next div?
HERE IS HTML:
<div class="container full-width margin-bottom-x">
<div class="row">
<div class="col-xs-12 col-sm-6 fund-text">
<div class="col-xs-12 col-sm-12 no-padding">
<div class="pull-left" style="margin-left: 0px;">
<img src="http://mezet.xyz/romeda/wp-content/uploads/2017/09/funds-projects-01.png" alt="Fund project" />
</div>
</div>
<p>Russia’s leading auto leasing company. Fully exited in 2015.</p>
<button type="button" class="btn btn-funds">More details</button>
</div>
<div class="col-xs-12 col-sm-6 fund-text">
<div class="col-xs-12 col-sm-12 no-padding">
<div class="pull-left" style="margin-left: 0px;">
<img src="http://mezet.xyz/romeda/wp-content/uploads/2017/09/fund-projects-02.png" alt="Fund project" />
</div>
</div>
<p>Russia’s largest Internet company and leading
search engine.</p>
<button type="button" class="btn btn-funds">More details</button>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 fund-text">
<div class="col-xs-12 col-sm-12 no-padding">
<div class="pull-left" style="margin-left:0px;">
<img src="http://mezet.xyz/romeda/wp-content/uploads/2017/09/fund-projects-03.png" alt="Fund project" />
</div>
</div>
<p>The leading e-commerce platform in Russia and the CIS.</p>
<button type="button" class="btn btn-funds">More details</button>
</div>
<div class="col-xs-12 col-sm-6 fund-text">
<div class="col-xs-12 col-sm-12 no-padding">
<div class="pull-left" style="margin-left:0px;">
<img src="http://mezet.xyz/romeda/wp-content/uploads/2017/09/fund-projects-04.png" alt="Fund project" />
</div>
</div>
<p>Independent oil and gas company.</p>
<button type="button" class="btn btn-funds">More details</button>
</div>
</div>
</div>
And CSS:
.fund-views{
font-family: Roboto;
background-color: #EFEFEF;
color: #000000;
text-align: center;
}
.fund-views .fund-text {
padding: 90px;
padding-left: 160px;
border: 1px solid #cccccc;
}
.fund-views .fund-text p{
font-size: 20px;
font-weight: 100;
text-align:left;
}

Creating a black and white grid HTML/CSS

I am trying to create a 3 by 3 black and white grid. But instead only black square is showing. I have tried using Bootstrap.
My one square of the grid should cover 3 grids space as per bootstrap grid system and I am using padding-top:100% to maintain the aspect ratio for the squares in the 3 by 3 grid.
body {
margin: 0;
color: pink;
}
.square {
width: 100%;
padding-top: 100%;
background-color: black;
}
.square-w {
width: 100%;
padding-top: 100%;
background-color: white;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="square"></div>
</div>
<div class=" col-md-3 ">
<div class="square-w"></div>
</div>
<div class=" col-md-3 ">
<div class="square"></div>
</div>
</div>
<div class="row">
<div class=" col-md-3">
<div class="square-w"></div>
</div>
<div class="col-md-3 ">
<div class="square"></div>
</div>
<div class="col-md-3">
<div class="square-w"></div>
</div>
</div>
<div class="row">
<div class="col-md-3 ">
<div class="square"></div>
</div>
<div class="col-md-3 ">
<div class="square-w"></div>
</div>
<div class="col-md-3 ">
<div class="square"></div>
</div>
</div>
</div>
Your screen view might be too small.
Changing all the col-md-3 classes to col-sm-3 allows it to be shown on my view
JSFiddle: https://jsfiddle.net/2k5523ym/1/
You just need to put below code in css
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
and then assign nopadding class to every col-md-3 div
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
<div class=" col-md-3 nopadding">
<div class="square-w"></div>
</div>
<div class=" col-md-3 nopadding">
<div class="square"></div>
</div>
</div>
<div class="row">
<div class=" col-md-3 nopadding">
<div class="square-w"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square-w"></div>
</div>
</div>
<div class="row">
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square-w"></div>
</div>
<div class="col-md-3 nopadding">
<div class="square"></div>
</div>
</div>
</div>
Hope this help you

Border in row and columns of bootstrap divs

I have created a jsFiddle. I want the border should be between both row lines but background color to like what its showing in js fiddle. How can I extend this column border line.
My Html
<div class="container top5">
<div class="row">
<div class="col-md-12 col-xs-12">
<div class="row">
<div class="col-md-3 col-xs-3 inner">
<div><b>Type</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>SMS</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>Email</b></div>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<div class=""><b>Business Unit</b></div>
</div>
</div>
</div>
<div class="col-md-12 col-xs-12">
<div class="row border-between">
<div class="col-md-3 col-xs-3 inner">
<span>Another tesing text</span>
</div>
<div class="col-md-3 col-xs-3 inner">
<span> test</span>
</div>
<div class="col-md-3 col-xs-3 inner">
<span>Random text</span>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<span>Random text</span>
</div>
</div>
</div>
</div>
</div>
And Css
.top5 {
margin-top: 50px;
}
.row {
border: 1px solid;
}
.row + .row {
border-top:0 ;
}
My Fiddle - https://jsfiddle.net/ff49tu79/13/
you may wanna use padding instead of margin in cells and use flex box to flex the div cells together
.top5 {
margin-top: 50px;
}
.row {
border: 1px solid;
}
.row + .row {
border-top: 0;
}
.flx {
display: flex;
}
.inner {
background: aliceblue;
border-right: 1px solid blue;
padding: 10px 15px;
}
.inner-end {
background: aliceblue;
padding: 10px 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container top5">
<div class="row">
<div class="col-md-12 col-xs-12">
<div class="row">
<div class="flx">
<div class="col-md-3 col-xs-3 inner">
<div><b>Type</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>SMS</b></div>
</div>
<div class="col-md-3 col-xs-3 inner">
<div class=""><b>Email</b></div>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<div class=""><b>Business Unit</b></div>
</div>
</div>
</div>
</div>
<div class="col-md-12 col-xs-12">
<div class="row border-between">
<div class="flx">
<div class="col-md-3 col-xs-3 inner">
<span>Another tesing text</span>
<div>1</div>
<div>2</div>
</div>
<div class="col-md-3 col-xs-3 inner">
<span> test</span>
</div>
<div class="col-md-3 col-xs-3 inner">
<span>Random text</span>
</div>
<div class="col-md-3 col-xs-3 inner-end">
<span>Random text</span>
</div>
</div>
</div>
</div>
</div>
</div>
See JSFIDDLE

Keep Divs at same height

I'm trying to figure out how to keep all of the rows the same height. The problem I run into is that when they have no content they shrink down to just the padding height.
The full example can be found here: https://jsfiddle.net/c85ajj9a/
Code snippet:
<div class="col-md-12">
<div class="col-md-1 detail-box leftcolumn-bold">Co-Bor 1:</div>
<div class="col-md-1 detail-box">Maria</div>
<div class="col-md-1 detail-box">Smith</div>
<div class="col-md-2 detail-box">699, 685, 675</div>
<div class="col-md-1 detail-box">$6,500.00</div>
<div class="col-md-2 detail-box email-text">maria.smith#gmail.com</div>
<div class="col-md-2 detail-box">714-555-5555</div>
<div class="col-md-2 detail-box">626-555-5555</div>
</div>
<div class="col-md-12">
<div class="col-md-1 detail-box leftcolumn-bold">Co-Bor 2:</div>
<div class="col-md-1 detail-box"></div>
<div class="col-md-1 detail-box"></div>
<div class="col-md-2 detail-box"></div>
<div class="col-md-1 detail-box"></div>
<div class="col-md-2 detail-box email-text"></div>
<div class="col-md-2 detail-box"></div>
<div class="col-md-2 detail-box"></div>
</div>
a min-height will add the height to the rows even if there is no content.
.detail-box {
padding: 5px;
overflow: auto;
border: 1px solid #000000;
text-align: center;
font-size:18px;
color:black;
min-height:18px;
}

Bootstrap 3 grid issues Firefox mis-alignment

I'm having a problem with a bootstrap based layout in Firefox.
Whats happening is that the rows are transitioning to the right when there is more than one row, but in Chrome and IE11 it doesn't do this.
Screenshot of how it looks in Firefox > http://i.imgur.com/GJEClw9.png
Screenshot of how it looks in Chrome/IE11 > http://i.imgur.com/baxNdJa.png
This is my CSS/HTML
.forumNavigation a:link, a:visited, a:hover, a:active {
color: #000;
text-decoration: none;
}
/*
Category headers
*/
.catHeader {
background-image: url(../../assets/img/bg.png);
background-repeat: repeat;
font-size: 14px;
font-weight: bold;
color: #fff;
line-height: 40px;
padding-left: 30px;
}
.catHeader a {
color: #fff;
text-decoration: none;
}
/*
Forum table borders to save space
*/
.forumTitleBlock,
.forumReplyBlock,
.forumlastPostInfo {
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
vertical-align: middle;
padding-top:8px;
padding-bottom:8px;
}
.postIcon,
.forumsLeftBlock,
.forumStats {
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
vertical-align: middle;
}
/*
Columns of same height styles (Part of the above Forum styles)
*/
.row-same-height {
display: table;
width: 100%;
}
.col-md-height {
display: table-cell;
float: none !important;
}
/*
Padding below each category
*/
.blank {
padding:10px;
}
/*
Forum Statistics Section
*/
.forumStats {
padding-top:7px;
padding-bottom:5px;
}
<div class="row">
<div class="col-md-6 animated" data-animation="fadeInUp" data-animation-delay="900"></div>
<div class="col-md-12 form-element animated" data-animation="fadeInUp" data-animation-delay="1200">
<div class="row">
<div class="col-md-12 forumContainer">
<div class="col-md-6 forumNavigation">Forum</div>
<div class="col-md-6 forumMessages text-right">Messages</div>
</div>
</div>
<div class="row">
<div class="col-md-12 catHeader" id="catHeader">Categories<a data-toggle="collapse" data-parent="catHeader" href="#coll-1" style="float:right"><i class="fa fa-sort" style="color:#777;"></i></a></div>
<div class="collapse in" id="coll-1">
<div class="row-same-height">
<div class="col-md-1 col-md-height forumsLeftBlock">icon</div>
<div class="col-md-7 col-md-height forumTitleBlock">Forum Title<br /> <small>test subtitle</small></div>
<div class="col-md-1 col-md-height forumReplyBlock">Topics<br />Replies</div>
<div class="col-md-3 col-md-height forumlastPostInfo">Last Post info</div>
</div>
<div class="row-same-height">
<div class="col-md-1 col-md-height forumsLeftBlock">icon</div>
<div class="col-md-7 col-md-height forumTitleBlock">Forum Title<br /> <small>test subtitle</small></div>
<div class="col-md-1 col-md-height forumReplyBlock">Topics<br />Replies</div>
<div class="col-md-3 col-md-height forumlastPostInfo">Last Post info</div>
</div>
</div>
</div>
<div class="blank"></div>
<div class="row">
<div class="col-md-12 catHeader text-center" id="statsHeader">Forum Statistics<a data-toggle="collapse" data-parent="statsHeader" href="#stats" style="float:right"><i class="fa fa-sort" style="color:#777;"></i></a></div>
<div class="collapse in" id="stats">
<div class="col-md-12 forumStats text-center">Topics: | Posts: | Members: </div>
</div>
</div>
</div>
</div>
After what Jey wrote, I rewrote the code to the following
<div class="row forumContainer">
<div class="col-md-8 forumNavigation">Forum</div>
<div class="col-md-4 forumMessages text-right">Messages</div>
</div>
<div class="row">
<div class="col-md-12 catHeader" id="catHeader">Categories
<a data-toggle="collapse" data-parent="catHeader" href="#coll-1" style="float:right"><i class="fa fa-sort" style="color:#777;"></i></a>
</div>
</div>
<div class="collapse in" id="coll-1">
<div class="row">
<div class="row-same-height">
<div class="col-md-1 col-md-height forumsLeftBlock">icon</div>
<div class="col-md-7 col-md-height forumTitleBlock">Forum Title<br /> <small>test subtitle<?php echo $forum['subtitle']; ?></small></div>
<div class="col-md-1 col-md-height forumReplyBlock">Topics<br />Replies</div>
<div class="col-md-3 col-md-height forumlastPostInfo">Last Post info</div>
</div>
</div>
<div class="row">
<div class="row-same-height">
<div class="col-md-1 col-md-height forumsLeftBlock">icon</div>
<div class="col-md-7 col-md-height forumTitleBlock">Forum Title<br /> <small>test subtitle<?php echo $forum['subtitle']; ?></small></div>
<div class="col-md-1 col-md-height forumReplyBlock">Topics<br />Replies</div>
<div class="col-md-3 col-md-height forumlastPostInfo">Last Post info</div>
</div>
</div>
</div>
<div class="blank"></div>
<div class="row">
<div class="col-md-12 catHeader text-center" id="statsHeader">Forum Statistics<a data-toggle="collapse" data-parent="statsHeader" href="#stats" style="float:right"><i class="fa fa-sort" style="color:#777;"></i></a></div>
</div>
<div class="row">
<div class="collapse in" id="stats">
<div class="col-md-12 forumStats text-center">Topics: 1234 | Posts: 5678 | Members: 1234</div>
</div>
</div>