I'm looking at the solution here on SO to set all columns in a bootstrap row to equal heights. It works fine in my fiddle, but in my browser with all other css the '.thumbnail.row.equalColumnHeight' css is not being used. There are black lines through it. I'm kinda a newbie to css, is there a way to override these black lines and get it to use the css for this class?
Here is what it looks like in Chrome dev tools.
here is the row in the browser - not equal heights.
Here is the code in fiddle where it shows unequal heights.
Here is the code.
html,
body,
.container-fluid,
.row {
height: 100%;
}
.row > div {
height: 100%;
}
.row .col-md-5 {
background-color: #eee;
top: 51px;
/*border: 1px solid black;*/
height: calc(100% - 51px);
padding-left: 0;
padding-right: 0;
}
.row .col-md-7 {
background-color: #ddd;
top: 51px;
/*border: 1px solid black;*/
height: calc(100% - 51px);
padding-left: 0;
padding-right: 0;
}
#googleResultMap {
width: 100%;
height: 100%;
/*border: 1px solid black;*/
}
.searchFilter {
/*width:200px;*/
height: 15%;
/*border: 1px solid blue;*/
}
.searchResults {
height: 85%;
border: 1px solid green;
overflow-y: scroll
}
input[readonly].default-cursor {
cursor: default;
background-color: white;
}
.date-field {
width: 120px;
}
##media only screen and (max-width:768px) {
/* only size 'xs' and below */
.searchResults {
height: 100%;
}
}
.thumbnail .col-lg-3 {
border: 1px solid red;
}
.searchResults {
height: 85%;
border: 1px solid green;
overflow-y: scroll
}
.thumbnail.row {
height: auto;
}
.cborder {
border: 1px solid pink;
}
.imageColumn {
padding-right: 0;
padding-left: 0;
}
.thumbnail.row.equalColumnHeight {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
<div class="container-fluid">
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5 hidden-xs">
#*Sidebar*#
<div id="googleResultMap"></div>
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">
#*Body content*#
<div class="searchFilter col-lg-12 col-md-12 col-sm-12 hidden-xs">
#Html.TextBoxFor(model => model.ClassDate, "{0:MM/dd/yyyy}", new { #class = "date-field form-control default-cursor", #readonly = "readonly" }) #Html.Hidden("classTime")
<br/>Time Filter
<br/>Open Classes Only
</div>
#*
<div class="searchResults col-lg-12 col-xs-12 col-sm-12">*#
<div class="searchResults col-lg-12 col-xs-12 col-sm-12">
<div class="thumbnail row equalColumnHeight">
<div class="col-lg-3 col-xs-3 imageColumn">
#*
<h3>Thumbnail label</h3>
<p>
<a class="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Link
</a>Test Data
</p>*#
<img src="http://www.joomlaworks.net/images/demos/galleries/abstract/7.jpg" class="img-responsive center-block" alt="Responsive image" style="width: 100%; border: 1px solid purple;">
<img src="http://www.joomlaworks.net/images/demos/galleries/abstract/7.jpg" class="img-responsive center-block" alt="Responsive image" style="width: 100%; border: 1px solid purple;">
<img src="http://www.joomlaworks.net/images/demos/galleries/abstract/7.jpg" class="img-responsive center-block" alt="Responsive image" style="width: 100%; border: 1px solid purple;">
</div>
<div class="col-lg-3 col-xs-3" style="text-align: center;">
#*
<h3>Thumbnail label</h3>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>*#
<i class="fa fa-users fa-5x" style="margin: auto;"></i>
</div>
<div class="col-lg-3 col-xs-3" style="text-align: center;">
#*
<h3>Thumbnail label</h3>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>*#
<i class="fa fa-user fa-5x" style="margin: auto;"></i>
</div>
<div class="col-lg-3 col-xs-3">
#*
<h3>Thumbnail label</h3>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>*#
</div>
<div class="collapse cborder" id="collapseExample">
<div class="well">
test data
<br />test data
<br />test data
<br />
</div>
</div>
</div>
</div>
#*</div>*#
</div>
</div>
</div>
To do same height columns in Bootstrap you need follow this answer. Simply add this code to your CSS:
.row [class*="col-"]{
margin-bottom: -99999px;
padding-bottom: 99999px;
}
.row{
overflow: hidden;
}
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I've been trying to make a row with 3 elements, but the third one just won't fit I've tried: changing the justify-content I've tried adding a flex:1 even tho in theory they should already have that. I've tried removing the margins beacaus I thought the flex containers may be too big to fit 3 of them in one row, but it didn't help.enter image description here
<div id="myprojects">
<div class="pr_cont">
<img id="project_img" src="images/img04.png" alt="">
<div class="project_div">
<p id="project_textA">Nascetur nunc varius commodo</p><br><br>
<p id="project_textB">Interdum amet accumsan placerat commodo ut amet aliquam blandit nunc tempor lobortis nunc non. Mi accumsan.</p><br><br>
View more
</div>
</div>
<div class="pr_cont">
<img id="project_img" src="images/img04.png" alt="">
<div class="project_div">
<p id="project_textA">Nascetur nunc varius commodo</p><br><br>
<p id="project_textB">Interdum amet accumsan placerat commodo ut amet aliquam blandit nunc tempor lobortis nunc non. Mi accumsan.</p><br><br>
View more
</div>
<div class="pr_cont">
<img id="project_img" src="images/img04.png" alt="">
<div class="project_div">
<p id="project_textA">Nascetur nunc varius commodo</p><br><br>
<p id="project_textB">Interdum amet accumsan placerat commodo ut amet aliquam blandit nunc tempor lobortis nunc non. Mi accumsan.</p><br><br>
View more
</div>
</div>
.
#myprojects {
display: flex;
justify-content:space-around;
width: 90%;
height: 50px;
margin: 0% 5% 0 5%;
}
.pr_cont {
margin: 0 5%;
width: 100%;
border-radius: 10px;
width: 400px;
}
#project_img {
border-radius: 10px 10px 0 0;
}
.project_div {
background-color: #333;
height: 250px;
width: 400px;
border-radius: 0 0 10px 10px;
}
#project_textA {
margin-top: -4px;
border-radius: 0 0 10px 10px;
color: white;
text-align:center;
padding-top: 30px;
font-size: 24px;
font-weight: 400;
}
#project_textB {
margin: 0;
font-size: 18px;
color: gray;
text-align: center;
}
#more_box {
text-decoration: none;
text-align: center;
color: white;
width: 10%;
margin: 0 5%;
background-color: #bd00ff;
padding: 20px 36%;
border-radius: 10px;
}
It seems an issue on your html, I am missing a </div> before the last item so it is being shown inside of the second one:
<div id="myprojects">
<div class="pr_cont">
...
</div>
<div class="pr_cont">
...
<div class="pr_cont">
...
</div>
</div>
So it should be like:
<div id="myprojects">
<div class="pr_cont">
...
</div>
<div class="pr_cont">
...
</div>
<div class="pr_cont">
...
</div>
</div>
I am trying to write a responsive footer. The footer items are separated by vertical bar (|). When we decrease the screen size, the footer items are wrapping to second line. Vertical bar (|) needs to be only between the footer items. Also facebook logo needs to be on the same line with the footer items for bigger screen sizes and on the center for smaller screen sizes. I used float:right but now they wrap from the beginning. How can I make them wrap from the end and hide vertical bar (|) if it is not between the footer items?
Here is my source code: https://jsfiddle.net/6kcdvteo/
body {
font-family: 'Calibri';
}
.text {
font-size: 1rem;
padding: 1rem 1rem 2rem 2rem;
color: #666666;
background-color: #f4f4f4;
}
.footer {
font-size: 0.85rem;
padding: 2rem 1rem 2rem 2rem;
background-color: #303741;
color: white;
}
.footer_company {
float: right;
padding-right: 2rem;
}
.footer_links {
font-size: 0.85rem;
background-color: #303741;
color: white;
padding-bottom: 2rem;
padding-right: 2.5rem;
}
.footer_links_span span {
background-color: #303741;
padding-right: 0.5rem;
float: right;
}
img {
height: 3rem;
width: 3rem;
}
.img {
padding-left: 1rem;
display: inline-block;
}
<div class="text">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ac cursus felis, ut egestas lacus. Sed nec elementum ipsum. Morbi metus est, venenatis at libero pharetra, suscipit posuere dolor. Proin a auctor nulla, sed tincidunt tellus. Nullam bibendum
luctus elit, sed porttitor lectus varius in. Cras venenatis rutrum urna at ultrices. Sed in luctus ligula.
</p>
</div>
<div class="footer">
<span class="footer_company">© My Company Name</span>
</div>
<div class="footer_links">
<div class="img">
<img src="https://image.flaticon.com/icons/png/512/124/124010.png">
</div>
<div class="footer_links_span">
<span>Sed metus</span>
<span>|</span>
<span>Aenean ultricies</span>
<span>|</span>
<span>Praesent vitae</span>
<span>|</span>
<span>Donec auctor</span>
<span>|</span>
<span>Vestibulum lobortis</span>
</div>
</div>
As part of your question you can use this
<div class="footer_links">
<div class="img">
<img src="https://image.flaticon.com/icons/png/512/124/124010.png" alt="">
</div>
<div class="footer_links_span">
<span><b>|</b> Sed metus</span>
<span><b>|</b> Aenean ultricies</span>
<span><b>|</b> Praesent vitae</span>
<span><b>|</b> Donec auctor</span>
<span><b>|</b> Vestibulum lobortis <b>|</b></span>
</div>
</div>
with this css
/* container */
.footer_links {
padding: 0.75rem 1.5rem;
font-size: 0.85rem;
background-color: #303741;
color: white;
}
/* clearfix floats */
.footer_links::after {
display: block;
clear: both;
content: "";
}
/* facebook img */
.img {
float: left;
}
.img img {
width: 3rem;
height: auto;
border: 0;
}
/* links */
.footer_links_span {
float: right;
width: calc(100% - 3.5rem);
text-align: right;
}
.footer_links_span span {
display: inline-block;
white-space: nowrap;
background-color: #303741;
}
.footer_links b {
padding: 0 0.2rem;
font-weight: inherit;
}
.footer_links_span span:first-child b {
padding-left: 0;
}
.footer_links_span span:last-child b {
padding-right: 0;
}
Maybe it will help you in the right direction.
This will solve your problem, but it's Bootstrap :) All your responsive screenshotes are implemented in this code. No extra css for the layout required.
EDIT: The included style is for the width of the links block and for hiding the pipe symbool on small screens.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Page</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<style type="text/css">
#footerSocial img { width: 3rem; margin-bottom: 0.5rem; }
#footerLinks > div { max-width: 350px; margin: auto; }
#footerLinks .dv { font-weight: inherit; display: none; }
#media (min-width: 576px) {
#footerSocial img { margin-bottom: 0; }
#footerLinks > div { max-width: none; padding-left: 100px; }
}
#media (min-width: 768px) {
#footerLinks > div { padding-left: 0; }
#footerLinks .dv { display: inline; }
}
</style>
</head>
<body>
<div class="container-fluid bg-secondary text-white">
<div class="row py-3">
<div class="col-12 text-center">
<h1 class="mb-2">Company Name</h1>
</div>
</div>
</div>
<div class="container">
<div class="row py-3">
<div class="col-12 ">
<h2>Article</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ac cursus felis, ut egestas lacus.
Sed nec elementum ipsum. Morbi metus est, venenatis at libero pharetra, suscipit posuere dolor.
Proin a auctor nulla, sed tincidunt tellus. Nullam bibendum luctus elit, sed porttitor lectus
varius in. Cras venenatis rutrum urna at ultrices. Sed in luctus ligula.</p>
</div>
</div>
</div>
<div class="container-fluid bg-dark text-white">
<div class="row px-2 py-3">
<div id="footerSocial" class="col-12 col-sm-2 text-center text-sm-left">
<img class="img-fluid bg-white" src="https://image.flaticon.com/icons/png/512/124/124010.png" alt="FB">
</div>
<div id="footerLinks" class="col-12 col-sm-10 text-center text-sm-right">
<div>
© Company Name<br>
<span class="text-nowrap">Sed metus</span>
<span class="text-nowrap">| Aenean ultricies</span>
<span class="text-nowrap">| Praesent vitae</span>
<span class="text-nowrap"><b class="dv">| </b>Donec auctor</span>
<span class="text-nowrap">| Vestibulum lobortis</span>
</div>
</div>
</div>
</div>
</body>
</html>
I want to add a number to the top left corner of my div's, but whatever I have tried so far has not worked properly.
Here is what I currently have:
Here is what I would like:
Here is the code:
#Office365, #OneDrive {
height: 100px;
width: 16.259%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
background-color: #F2F2F2;
}
<div class="row" id="firstAppRow">
<div class="col-sm-2" id="Office365" style="padding-top: 20px; font-weight: bold;">
<span>1</span>
<div><img src="/TrainingResourceCenter/O365Training/PublishingImages/OVbiWcG.png" height="50px" width="50px" />
<p>Office365</p>
</div>
</div>
<div class="col-sm-2" id="OneDrive" style="padding-top: 20px; font-weight: bold;">
<div><img src="/TrainingResourceCenter/O365Training/PublishingImages/wJAtQYP.png" height="40px" width="40px" />
<p>OneDrive</p>
</div>
</div>
</div>
He, the solution will be to use absolute position for the numbers.
Note that the blocks containing the tag with the number will need to be positioned relative so that the numbers are absolute to that block. Here is a sample code
#Office365,#OneDrive{
display: inline-block;
margin-right: 2px;
background-color: #F2F2F2;
position:relative;
border:1px solid black;
padding: 0 50px;
text-align: center;
}
#Office365 img,#OneDrive img{
width:100px;
height: auto;
}
.num{
position: absolute;
top: 5px;
left: 5px;
}
<div class="row" id="firstAppRow">
<div class="col-sm-2" id="Office365" style="padding-top: 20px; font-weight: bold;">
<div><img src="https://png.icons8.com/color/1600/office-365.png" height="50px" width="50px" />
<p>Office365</p>
<span class="num">1</span>
</div>
</div>
<div class="col-sm-2" id="OneDrive" style="padding-top: 20px; font-weight: bold;">
<div><img src="https://bcpsodl.pbworks.com/f/1477585037/onedrive.png" height="40px" width="40px" />
<p>OneDrive</p>
<span class="num">2</span>
</div>
</div>
</div>
Try assigning
position: relative;
to the #Office365 and #OneDrive. Also put the images inside those divs.
Then assign
position: absolute;
left: 1px;
top: 1px;
to #Office365 span and #OneDrive span.
absolute vs float
.a {
width: 200px;
position: relative;
border: 1px solid gray;
margin-right:20px;
display:inline-block;
vertical-align:top;
}
.viaAbsolute {
position: absolute;
top:0;
left: 0;
padding: 3px;
border: 1px solid red;
}
.viaFloat {
float: left;
padding: 3px;
border: 1px solid red;
}
<div class="a">
<span class="viaAbsolute">
1
</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam tempus rhoncus quam quis vestibulum. Cras eu mollis nisl. Pellentesque semper tincidunt placerat.
</div>
<div class="a">
<span class="viaFloat">
1
</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam tempus rhoncus quam quis vestibulum. Cras eu mollis nisl. Pellentesque semper tincidunt placerat.
</div>
I have tried to create a page layout with three scrolling columns with flexbox.
Google Chrome displays the result nicely:
but Edge or Internet Explorer behave differently:
So far i have tried to adjust
.box {
display: flex;
flex: 1;
flex-direction: column;
}
But none of the combinations did the trick.
I'm quite confused because it is working with .sidebar
Here is my code:
html,
body {
padding: 0;
margin: 0;
}
.headerPane {
height: 66px;
background-color: #ccc;
}
.footerPane {
position: absolute;
height: 49px;
bottom: 0;
left: 0;
width: 100%;
background-color: #ccc;
}
.body {
position: absolute;
top: 66px;
right: 0;
bottom: 49px;
left: 0;
display: flex;
}
.actionPane {
height: 40px;
background-color: #999;
}
.sidebar {
width: 100px;
overflow-y: scroll;
}
.main {
flex: 1;
display: flex;
flex-direction: column;
}
.content {
flex: 1;
display: flex;
overflow: auto;
flex-direction: column;
}
.box {
display: flex;
}
.column {
padding: 10px;
}
.column > div {}
.column:nth-child(1) {
overflow-y: scroll;
width: 100px;
}
.column:nth-child(2) {
width: 250px;
overflow-y: scroll;
}
<div class="headerPane">headerPane (no scoll)</div>
<div class="body">
<div class="sidebar">sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />sidebar
<br />
</div>
<div class="main">
<div class="actionPane">actionPane with buttons (no scroll)</div>
<div class="content">
<div class="box">
<div class="column">
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
<div>Sub 1</div>
</div>
<div class="column">
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ut mattis dui. Suspendisse consequat tincidunt ligula quis pretium. Praesent facilisis turpis urna, vitae mollis turpis condimentum quis. Fusce molestie nulla venenatis erat consectetur,
feugiat congue leo mollis. Nam ac magna ut metus venenatis dapibus. Suspendisse ornare ullamcorper tellus, quis tempus nisi aliquet vel. Sed congue sollicitudin libero id posuere. Nunc maximus aliquam eros.</div>
</div>
</div>
</div>
</div>
</div>
<div class="footerPane">Footer (no scroll)</div>
i have also created a fiddle here: https://jsfiddle.net/p3e7ka20/8/
Thanks in advance.
Add following css:
.box {
height: 100%;
}
overflow-y needs some defined height to work properly.
I have 4 columns in a row and I cannot get the row centered. It's so weird...
If you look at the pic at the bottom, you can see the row is not centered by looking at the vertical border under the "most read" blue square.
html file:
<div class="block-section">
<div class="sm-section-wrapper">
<div class="row">
<div class="sm-preview-title">
MOST READ
</div>
</div>
<div class="row">
<div class="col-3">
<div class="sm-preview-wrapper">
<h3 class="preview-sm">
hello world
</h3>
<h2 class="preview-sm">
Vestibulum id ligula porta felis euismod semper.
</h2>
</div>
</div>
<div class="col-3">
<div class="sm-preview-wrapper">
<h3 class="preview-sm">
hello world
</h3>
<h2 class="preview-sm">
Vestibulum id ligula porta felis euismod semper.
</h2>
</div>
</div>
<div class="col-3">
<div class="sm-preview-wrapper">
<h3 class="preview-sm">
hello world
</h3>
<h2 class="preview-sm">
Vestibulum id ligula porta felis euismod semper.
</h2>
</div>
</div>
<div class="col-3">
<div class="sm-preview-wrapper">
<h3 class="preview-sm">
hello world
</h3>
<h2 class="preview-sm">
Vestibulum id ligula porta felis euismod semper.
</h2>
</div>
</div>
</div>
</div>
</div>
and here is my scss file:
.sm-preview-wrapper{
text-align: center;
border-right: 1px solid $light-gray;
padding: 0 35px;
}
.sm-section-wrapper{
#include clearfix();
.col-3{
margin: 0;
&:last-child{
.sm-preview-wrapper{
border-right: none;
}
}
}
padding-top: 50px;
padding-bottom: 36px;
.sm-preview-title{
padding-top: 6px;
text-align: center;
height: 30px;
width: 165px;
margin: 0 auto;
background: $blue;
font-family: $montserrat;
font-weight: bold;
color: white;
font-size: 14px;
}
}
Check out this fiddle: http://jsfiddle.net/9v98r58s/
You are using the border for .sm-preview-wrapper and not its parent .col-sm-3 which has a padding of 15px.
A solution is to use :after for the border
.sm-preview-wrapper:after{
position:absolute;
right:-15px;
width:1px;
top:0;
bottom:0;
content:'';
background:red;
}
I had to add a percentage margin to the first and last child to take up the entire width and center it.