I'm trying to make a layout like this using bootstrap.
However, I keep getting this
Does anyone know how to prevent the second row from being pushed down by the large column?
Here is a skeleton of my HTML:
<div class="container">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 about">
<img >
</div>
<div class="col-xs-3 col-sm-3 col-md-3 resume">
<img >
</div>
<div class="col-xs-3 col-sm-3 col-md-3 websites">
<img >
</div>
</div>
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 waterfall">
<img >
</div>
<div class="col-xs-6 col-sm-6 col-md-6 middlebox">
<p id="middletext"><strong></strong><br></p>
</div>
</div>
</div>
and here is the corresponding CSS:
.col-xs-3{
height: 33vh;
margin-bottom: 3vh;
padding: 0;
border: 2px solid black;
}
.col-xs-3.resume{
margin-top: 3vh;
}
.col-xs-3.websites{
height: 60vh;
margin-top: 3vh;
}
.col-xs-6{
height: 33vh;
margin-bottom: 3vh;
padding: 0px;
border: 2px solid black;
}
.col-xs-6.about{
margin-top: 3vh;
}
Another option for this sort of no-gaps layout is to use something like Masonry, although it's probably overkill if your actual layout is as simple as your example.
One way that I can think of is to use one div as parent for the first 2 columns:
html:
<div class="container">
<div class="row">
<div class="col-xs-9 col-sm-9 col-sm-9" >
<div class="col-xs-8 col-sm-8 col-md-8 about">
<img >
</div>
<div class="col-xs-4 col-sm-4 col-md-4 resume">
<img >
</div>
<div class="col-xs-4 col-sm-4 col-md-4 waterfall">
<img >
</div>
<div class="col-xs-8 col-sm-8 col-md-8 middlebox">
<p id="middletext"><strong></strong><br></p>
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 websites">
<img >
</div>
</div>
</div>
css
.col-xs-4{
height: 33vh;
margin-bottom: 3vh;
padding: 0;
border: 2px solid black;
}
.resume{
margin-top: 3vh;
}
.websites{
height: 68vh;
margin-top: 3vh;
border: 2px solid black;
}
.col-xs-8{
height: 33vh;
margin-bottom: 3vh;
padding: 0px;
border: 2px solid black;
}
.col-xs-8.about{
margin-top: 3vh;
}
Related
How do we put small boxes (on the right) next to the big box (on the left)? I tried using float: left; in CSS but its not working!?
Thanks in advance!
Here is the CSS and HTML:
.container1{
background-color: #f1f1f1;
height: 170px;
width: 170px;
padding: 20px;
border: 1px solid #bfbfbf;
margin: 10px;
}
.container-fluid{
float: right;
padding-left: 320px;
padding-right: 20px;
}
h1{
padding-left: 20px;
padding-right: 20px;
}
.uiBox{
background-color: #f1f1f1;
height: 300px;
width: 300px;
padding: 20px;
border: 1px solid #bfbfbf;
}
<head>
<title>{{ title }}</title>
<link rel="stylesheet" href="static/index.css">
</head>
<body>
<h1>Hello World</h1>
<aside>
<div class="uiBox" data-search-type="category/tree">
<ul class="categories">
<li class="category-001">
</li>
</ul>
</div>
</aside>
<div class="container-fluid">
<div class="row">
<div class="container1 col-md-2 col-sm-2 col-xs-3"></div>
<div class="container1 col-md-2 col-sm-2 col-xs-3"></div>
<div class="container1 col-md-2 col-sm-2 col-xs-3"></div>
<div class="container1 col-md-2 col-sm-2 col-xs-3"></div>
<div class="container1 col-md-2 col-sm-2 col-xs-3"></div>
</div>
</div>
</body>
It fits like this
<body>
<div class="container-fluid">
<div class="row">
<div class="uiBox" data-search-type="category/tree" class="col-xs-4">
<ul class="categories">
<li class="category-001">
</li>
</ul>
</div>
<div class="container1 col-xs-2"></div>
<div class="container1 col-xs-2"></div>
<div class="container1 col-xs-2"></div>
<div class="container1 col-xs-2"></div>
<div class="container1 col-xs-2"></div>
</div>
</div>
</body>
I'm trying to make a row responsive in a way that mobile rows go vertically instead of horizontal and I still have all those fancy boxes, could anyone help me in any way?
I already tried changing the columns up, css-flexbox, but I'm most likely just doing something horribly wrong.
#caixas {
background-color: #58373791;
padding-top: 5px;
padding-right: 30px;
padding-bottom: 5px;
padding-left: 25px;
}
#caixas2 {
background-color: #b6696a91;
padding-top: 5px;
padding-right: 30px;
padding-left: 25px;
padding-bottom: 5px;
}
#border {
border: solid 3px red;
}
<div class='col-lg-12 col-md-12 col-sm-12'>
<div id="border" class="container">
<div class="row">
<div class="col-lg-4 col-sm-6 mb-4">
<div id="caixas" class="container">
<h3 class="h2sm" align="center">Estudante </h3>
<h4 class="h1sm " align="center">Português</h4>
</div>
<div id="caixas2" class="container">
<h3 class="h3sm" align="center">Portuguese Student</h3>
</div>
</div>
<div class="col-lg-4 col-sm-6 mb-4">
<div id="caixas" class="container">
<h3 class="h2sm" align="center">Estudante </h3>
<h4 class="h1sm " align="center">Internacional</h4>
</div>
<div id="caixas2" class="container">
<h3 class="h3sm" align="center">Internacional Student</h3>
</div>
</div>
<div class="col-lg-4 col-sm-6 mb-4">
<div id="caixas" class="container">
<h3 class="h2sm" align="center">Estudante </h3>
<h4 class="h1sm " align="center">Intercâmbio</h4>
</div>
<div id="caixas2" class="container">
<h3 class="h3sm" align="center">Exchange Student</h3>
</div>
</div>
</div>
</div>
</div>
I made this complicated layout in bootstrap but, the point is when I remove to image below on the right side, all other images changing smaller.
How can I have this always same size?
I tried to work with numbers for width and height but the result was bad!
The number of images will change based on the titles so I might have 3 images or 2 or 5.
Please help me!
Before removing
After removing
.container-fluid .expo {
margin-left: 20px;
margin-right: 20px;
text-align: center;
float: none;
margin-bottom: 20px;
}
.expoinfo {
display: inline-block;
padding: 0;
}
.expoinfo h3 {
font-size: 22px;
margin-top: 0px;
padding-right: 20px;
text-align: left;
}
.bigimg {
padding: 0;
border-radius: 0;
margin: 0;
overflow: hidden;
text-align: center;
}
.bigimg img {
border-radius: 0;
width: 100%;
padding-left: 2px;
padding-right: 2px;
padding-top: 2px;
padding-bottom: 2px;
height: 100%;
}
.colthumb {
overflow: hidden;
margin: 0;
padding: 0;
float: left;
}
.thumbnail {
padding: 0;
margin: 0;
border-style: none;
}
.thumbnail img {
width: 100%;
padding-top: 2px;
padding-right: 2px;
padding-left: 2px;
padding-bottom: 2px;
border-radius: 0;
border-style: none;
height: 100%;
}
<div class="container-fluid expo">
<div class="row expoinfo">
<section class="col-lg-10 col-lg-offset-1">
<h3>title</h3>
<div class="bigimg col-sm-6 col-md-6 col-lg-6">
<a href="http://fakeimg.pl/700x400/" title="">
<img src="http://fakeimg.pl/600x600/" alt="">
</a>
</div>
<div class="colthumb col-sm-3 col-xs-6 col-md-3 col-lg-3">
<div class="thumbnail">
<a href="http://fakeimg.pl/700x400/" title="">
<img src="http://fakeimg.pl/300x300/" alt="">
</a>
</div>
</div>
<div class="colthumb col-sm-3 col-xs-6 col-md-3 col-lg-3">
<div class="thumbnail">
<a href="http://fakeimg.pl/700x400/" title="">
<img src="http://fakeimg.pl/300x300/" alt="">
</a>
</div>
</div>
<div class="colthumb col-sm-3 col-xs-6 col-md-3 col-lg-3">
<div class="thumbnail">
<a href="http://fakeimg.pl/700x400/" title="">
<img src="http://fakeimg.pl/300x300/" alt="">
</a>
</div>
</div>
<div class="colthumb col-sm-3 col-xs-6 col-md-3 col-lg-3">
<div class="thumbnail">
<a href="http://fakeimg.pl/700x400/" title="">
<img src="http://fakeimg.pl/300x300/" alt="">
</a>
</div>
</div>
</section>
</div>
</div>
The example you made didn't include bootstrap.css even though it was using bootstrap's classes.
See updated demo: https://jsfiddle.net/2aLdmvw4/
I just found my answer!
<div class="row">
<section class="col-lg-offset-2 col-lg-8">
<h3>title</h3>
<div class=" thumbcol col-md-4 col-lg-6">
<div class="thumbnail"><img src="http://fakeimg.pl/300x300/" alt="Thumbnail Image">
</div>
</div>
<div class=" thumbcol col-md-4 col-lg-3">
<div class="thumbnail"><img src="http://fakeimg.pl/300x300/" alt="Thumbnail Image"> </div>
</div>
<div class=" thumbcol col-md-4 col-lg-3">
<div class="thumbnail"><img src="http://fakeimg.pl/300x300/" alt="Thumbnail Image"></div>
</div>
<div class=" thumbcol col-md-4 col-lg-3">
<div class="thumbnail"><img src="http://fakeimg.pl/300x300/" alt="Thumbnail Image"></div>
</div>
</section>
</div>
I have been trying to get the following done with css with no avail.
This is the closest I've gotten to something like this.
As you see, I am close, but no cigar. I need the dashes (or lines preferably, but won't get picky) are not all reaching the number. I tried taking them all the way over and use overflow:hidden, but nothing. And also, this is a responsive site so it has to respect responsiveness as well.
Here is my code. THANKS!! :
HTML
<div class="col-md-12 allocation">
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">Equities</div>
<div class="col-md-2 col-sm-2 col-xs-2">65%</div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">Domestic large capitalized firms</div>
<div class="col-md-2 col-sm-2 col-xs-2">25%</div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">Domestic small capitalized firms</div>
<div class="col-md-2 col-sm-2 col-xs-2">15%</div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">International developed markets</div>
<div class="col-md-2 col-sm-2 col-xs-2">15%</div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">International emerging markets</div>
<div class="col-md-2 col-sm-2 col-xs-2">10%</div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10"><strong>Fixed Income</strong></div>
<div class="col-md-2 col-sm-2 col-xs-2"><strong>15%</strong></div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10"><strong>Real Estate</strong></div>
<div class="col-md-2 col-sm-2 col-xs-2"><strong>20%</strong></div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">Core</div>
<div class="col-md-2 col-sm-2 col-xs-2">12.5%</div>
</div>
<div class="row">
<div class="col-md-10 col-sm-10 col-xs-10">Timber</div>
<div class="col-md-2 col-sm-2 col-xs-2">7.5%</div>
</div>
</div>
CSS:
.allocation .row{
margin:15px auto;
}
.allocation .row > div.col-md-10.col-sm-10.col-xs-10:after{
content: "--------------------------------------------------- ";
}
If you want to achieve this, you can check the code here or here:
<div class="col-xs-12">
<div class="row">
<div>Equities</div>
<div>65%</div>
</div>
<div class="row">
<div>Domestic large capitalized firms</div>
<div>25%</div>
</div>
<div class="row">
<div>Domestic small capitalized firms</div>
<div>15%</div>
</div>
<div class="row">
<div>International developed markets</div>
<div>15%</div>
</div>
<div class="row">
<div>International emerging markets</div>
<div>10%</div>
</div>
<div class="row">
<div><strong>Fixed Income</strong></div>
<div><strong>15%</strong></div>
</div>
<div class="row">
<div><strong>Real Estate</strong></div>
<div><strong>20%</strong></div>
</div>
<div class="row">
<div>Core</div>
<div>12.5%</div>
</div>
<div class="row">
<div>Timber</div>
<div>7.5%</div>
</div>
</div>
With this css code:
.row {
border-bottom: 1px dashed black;
height: 15px;
clear: right;
margin-bottom: 16px;
}
.row div:first-of-type {
float: left;
background: #FFF;
padding-right: 5px;
}
.row div:last-of-type {
float: right;
margin-top: 1px;
background: #FFF;
width: 50px;
text-align: right;
}
There are several solutions for this... here is one:
.index-row{
border-bottom: 1px dashed;
height:1.5em;
clear:both;
}
.index-row h2, .index-row span{
padding:5px;
margin:0;
line-height:1.0em;
background:white;
}
.index-row h2{
float:left;
}
.index-row span{
float:right;
}
<div>
<div class="index-row">
<h2>titulo indice</h2>
<span>45</span>
</div>
<div class="index-row">
<h2>titulo indice</h2>
<span>45</span>
</div>
<div class="index-row">
<h2>titulo indice</h2>
<span>45</span>
</div>
</div>
Simple and responsive solution using grid:
.index-item {
display: grid;
justify-content: space-between;
align-items: baseline;
grid-template-columns: auto 1fr auto;
gap: .5rem;
padding-block: .5rem;
}
.index-line {
height: 3px;
min-width: 15px;
background: linear-gradient(90deg, #888 2.5%, #fff 2.5%, #fff 47.5%, #888 47.5%, #888 52.5%, #fff 52.5%, #fff 97.5%, #888 97.5%);
background-size: 10px 10px;
background-position: 50px 50px;
}
<div class="index-item">
<div class="index-title">Page Title</div>
<span class="index-line"></span>
<div class="index-number">200</div>
</div>
<div class="index-item">
<div class="index-title">Page Title (long title)</div>
<span class="index-line"></span>
<div class="index-number">230</div>
</div>
there's some problems with responsive grid system to me.
http://imageshack.com/a/img537/9687/4H48G0.jpg
http://imageshack.com/a/img539/8265/ANvr0Y.jpg - problem is here
My source code:
CSS
<style type="text/css">
.wrapper {
height: 100%;
text-align: center;
margin: 0 auto;
}
img { max-width:100% !important;
height:auto;
display:block;
}
.text {
color: #fff;
text-shadow:0px 2px 10px #000;
height: 100%;
left: 0;
position: absolute;
text-align: center;
top: 0;
font-size: 22px;
width: 100%;}
.box {
border: 1px dashed #000;
overflow: hidden;
position: relative;
}
.tb_floater {
font-size: 1.5em;
margin-top: 20%;
padding-top: 10%;
}
.box.tall {
height: 300px;
}
.box.tall > a > img {
height: auto;
}
</style>
HTML
<div class="wrapper">
<div class="container">
<div class="row">
<div class="col-md-4 box tall">
<a href="#">
<img src="http://www.websailer.com/wp-content/uploads/2013/07/www_image.jpg">
</a>
<div class="text tall">
<div class="tb_floater">
<p>Loren ipsum shit amet<br/>Loren ipsum</p>
</div>
</div>
</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-6</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-2</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-2</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-6</div>
</div>
<div class="row">
<div class="pull-right col-xs-6 col-md-4 box tall">
<a href="#">
<img src="http://www.websailer.com/wp-content/uploads/2013/07/www_image.jpg">
</a>
<div class="text tall">
<div class="tb_floater">
<p>Loren ipsum shit amet<br/>Loren ipsum</p>
</div>
</div>
</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-6</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-2</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-6</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-2</div>
</div>
That empty field is problem when i resize the browser, any solution ?