Bootstrap/CSS: Layout issues inside 3-columns layout - html

I'm using Bootstrap 3 and I have a full width row with 3 col-lg-4, each column with an icon, a title and a subtitle. But now I'd like to place the icon and text side by side, like this:
Initial HTML:
<div class="cover-container">
<div class="row">
<div class="col-lg-4">
<div class="tile">
<img src="" />
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div
…
…
</div>
</div>
.cover-container {
margin: 0 auto;
width: 100%;
padding: 0px;
}
.tile {
text-align: center;
}
I've tried with 8 col-lg-2, but I don't like that it shows each column as a row on a smartphone.
I prefer to use 3 centered col-lg-4, but I can not place elements like in the mock-up,
can you help? Thanks…
SOLUTION:
<div class="cover-container">
<div class="row">
<div class="col-sx-4 col-sm-4 col-md-4 col-lg-4">
<div class="row">
<div class="col-xs-6 cover-tile-image">
<img src="/assets/images/1.png" alt="" />
</div>
<div class="col-xs-6 cover-tile-text">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
</div>
…
…
</div>
</div>
.cover-tile-image {
text-align: right;
padding-right: 5px;
}
.cover-tile-text {
padding-left: 5px;
}

I'm just going to point out to y'all that:
class="col-xs-4 col-sm-4 col-md-4 col-lg-4"
is extremely redundant, and equivalent to the much-simpler:
class="col-xs-4"
I encourage y'all to read Bootstrap's grid docs:
Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes, and override grid classes targeted at smaller devices. Therefore, applying any .col-md- class to an element will not only affect its styling on medium devices but also on large devices if a .col-lg- class is not present.

I'm still new in using bootstrap 3. Check the demo below I created. Hope this helps.
Fiddle
HTML
<div class=".col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="tile">
<img src="http://placekitten.com/g/64/64" class="img-thumbnail" />
</div>
<div class="info">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
CSS
.tile, .info {
float:left;
}

Here is the solution :) with working example.
Find here more information about the grids.
This solution is also RESPONSIVE READY.
HTML:
<div class="row well">
<div class="col-sx-4 col-sm-4 col-md-4 col-lg-4">
<div class="row ">
<div class="col-sx-3 col-sm-3 col-md-3 col-lg-3">
<img src="//placehold.it/50x50" />
</div>
<div class="col-sx-9 col-sm-9 col-md-9 col-lg-9">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
</div> <div class="col-sx-4 col-sm-4 col-md-4 col-lg-4">
<div class="row ">
<div class="col-sx-3 col-sm-3 col-md-3 col-lg-3">
<img src="//placehold.it/50x50" />
</div>
<div class="col-sx-9 col-sm-9 col-md-9 col-lg-9">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
</div> <div class="col-sx-4 col-sm-4 col-md-4 col-lg-4">
<div class="row ">
<div class="col-sx-3 col-sm-3 col-md-3 col-lg-3">
<img src="//placehold.it/50x50" />
</div>
<div class="col-sx-9 col-sm-9 col-md-9 col-lg-9">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
</div>
</div>
CSS
h3{margin:0;}

HTML
<div id="wrapper">
<div class="row">
<div class="columns">
<img src="//placehold.it/100x100" />
</div>
<div class="columns">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
<div class="row">
<div class="columns">
<img src="//placehold.it/100x100" />
</div>
<div class="columns">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
<div class="row">
<div class="columns">
<img src="//placehold.it/100x100" />
</div>
<div class="columns">
<h3>Title</h3>
<p>Lorem ipsum</p>
</div>
</div>
</div>
CSS
#wrapper
{
width:1000px;
margin:0px;
padding:0px;
}
.columns
{
float:left;
display:inline-block;
width:120px;
height:110px;
}
Demos
Fiddle Demo
Result Demo
Output

Related

3 column layout but 1 under the 2

How would i do something like this? http://jsfiddle.net/BxaNN/369/
but with the top column in the center top?
NOTE: this is not my code
<div class="container">
<div class="row">
<div id="content" class="col-lg-4 col-lg-push-4 col-sm-12 ">
<h2></h2>
<p></p>
</div>
<div id="sidebar-left" class="col-lg-4 col-sm-6 col-lg-pull-4">
<h2></h2>
<p></p>
</div>
<div id="sidebar-right" class="col-lg-4 col-sm-6">
<h2></h2>
<p></p>
</div>
</div>
</div>
The bootstrap classes you have already does this for you. You just need to reference the bootstrap cdn. You could also, center the text to make it pretty. check out the grid system here: Bootstrap Resource
.container {
text-align: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div id="content" class="col-lg-4 col-lg-push-4 col-sm-12 ">
<h2>1</h2>
<p>1</p>
</div>
<div id="sidebar-left" class="col-lg-4 col-sm-6 col-lg-pull-4">
<h2>2</h2>
<p>2</p>
</div>
<div id="sidebar-right" class="col-lg-4 col-sm-6">
<h2>3</h2>
<p>4</p>
</div>
</div>
</div>

Horizontally aligning elements in a div

I am trying to align three elements in a div in such a way that the image is inline with h1 while the p tag is beneath the h1 tag.
.valign{
position:relative;
top: 50%;
transform: translateY(-50%);
vertical-align: middle;
}
.banner{
position: relative;
height: 100vh;
width:100vw;
background: #eee;
}
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<img src="img/logo.png" style="height: 150px;width: 150px">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p>
</div>
</div>
</div>
</div>
</div>
Here is an image for reference:
This is how the elements must be arranged
This is how the elements are looking right now:
This is a screenshot of the webpage
Any help would be appreciated.
Try this
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<div class="float-xs-left float-sm-left float-md-left">
<img src="img/logo.png"></div>
<div class="float-xs-left float-sm-left float-md-left">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p></div>
</div>
</div>
</div>
</div>
</div>
the class value for float is based on bootstrap 4
Try this html
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<div style="float:left">
<img src="img/logo.png" style="height: 150px;width: 150px"></div>
<div style="float:left">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p></div>
</div>
</div>
</div>
</div>
</div>
Use floats, Bootstrap provides pull-left and pull-right helper classes, so use it on the two parts of your layout to have them side-by-by.
You need to add some margins here and there to make it look good.
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<div class="row">
<div class="pull-left">
<img src="img/logo.png" style="height: 150px;width: 150px">
</div>
<div class="pull-left">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
https://jsfiddle.net/n8o1w3cq/

Image gets really small when I put it in a column

My png images gets really small when I put them inside a column in a row. However they are fine when there is not column but then they do not appear as a row and appear one above the other. I have no idea what may be causing the problem.
What I want to do: I want them to appear like this.
<div class="container">
<div class="row" id="parent">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 block left">
<div class="heading">
<h3> Simple to Enjoy </h3>
</div>
<div class="inside">
<div class="row">
<div class=""> <!--These Images!!!-->
<img class="img img-responsive img-sec-4" src="images\home_section_4_free_ride.png">
<p>Free Rides </p>
</div>
<div class="">
<img class="img img-responsive img-sec-4" src="images\home_section_4_membership.png">
<p>Free XXX Membership </p>
</div>
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 block center">
<div class="heading">
<h3> Simple to Earn </h3>
</div>
<div class="inside">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 block right">
<div class="heading">
<h3> Simple to Save </h3>
</div>
<div class="inside">
</div>
</div>
</div>
</div>
Sorry for bad english and indent.
Here is my CSS:
#parent {
text-align:center;
height:400px;
width:100%;
}
.center {
margin:auto
}
.left {
margin:auto auto auto 0;
}
.right {
margin:auto 0 auto auto;
}
.img-sec-4 {
height: auto;
width: auto;
}
EDIT:
Here is the screenshot of my result:
(The red highlighted area is where the problem is)
simply add class col-xs-6 to the div wrapping those images (each one)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row" id="parent">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 block left">
<div class="heading">
<h3> Simple to Enjoy </h3>
</div>
<div class="inside">
<div class="row">
<div class="col-xs-6">
<!--These Images!!!-->
<img class="img img-responsive img-sec-4" src="//lorempixel.com/200/200">
<p>Free Rides</p>
</div>
<div class="col-xs-6">
<img class="img img-responsive img-sec-4" src="//lorempixel.com/200/200">
<p>Free XXX Membership</p>
</div>
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 block center">
<div class="heading">
<h3> Simple to Earn </h3>
</div>
<div class="inside">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 block right">
<div class="heading">
<h3> Simple to Save </h3>
</div>
<div class="inside">
</div>
</div>
</div>
</div>

How to achieve a layout with 3 columns and a footer

I am trying to build this footer with bootstrap 3.3. The footer looks like this:
Text Left - Social Icons - Text Right
Here is what I tried:
http://jsfiddle.net/bsumgcpk/1/
<div class="container black">
<div class="col-xs-6 col-sm-4 white"><p> COPYRIGHT © 2014</p></div>
<div class="col-xs-6 col-sm-4 white text-center">
<img src="icon-g-.png" alt="google+">
<img src="icon-twitter.png" alt="twitter">
<img src="icon-fb.png" alt="facebook">
</div>
<div class="col-xs-6 col-sm-4 right"><p> right text</p></div>
</div>
You forgot to put the columns inside row div.Bootstrap has 12 column grid system, so the sum of your columns should be 12.Thats why i used 3 columns of size 4.
Working JSFiddle.
p {
color: white;
}
.black {
background: #000;
}
.right {
text-align:right;
}
<link href="http://www.kissingerassoc.com/~order-portal/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container black">
<div class="row">
<div class="col-xs-4 col-sm-4 white">
<p>COPYRIGHT © BITPHONE.ES 2014</p>
</div>
<div class="col-xs-4 col-sm-4 white text-center">
<img src="https://bitphone.es/wp-content/uploads/2015/07/icon-g-.png" alt="google+" />
<img src="https://bitphone.es/wp-content/uploads/2015/07/icon-twitter.png" alt="twitter" />
<img src="https://bitphone.es/wp-content/uploads/2015/07/icon-fb.png" alt="facebook" />
</div>
<div class="col-xs-4 col-sm-4 right">
<p>right text</p>
</div>
</div>
</div>

How to set fixed space between columns with different height with Bootstrap 3?

I'm trying to have a nice grid of items on my site using Bootstrap 3 grid, while each item has a different height.
The problem is that i get different spaces between the items.
Forgive me for the long code, I had to write 6 items in order to show the problem. Once you read the first you'll notice it repeats but with different length due to different item description.
<div class="container">
<div class="row-fluid">
<div class="col col-sm-6 col-md-4">
<div class="result-padder">
<div class="box">
<p class="boxTitle">vendor1</p>
<p class="boxDescription">Description of vendor1</p>
</div>
</div>
</div>
<div class="col col-sm-6 col-md-4">
<div class="result-padder">
<div class="box">
<p class="boxTitle">vendor2</p>
<p class="boxDescription">Description of vendor2 which is longer and the layout takes more than one line...</p>
</div>
</div>
</div>
<div class="col col-sm-6 col-md-4">
<div class="result-padder">
<div class="box">
<p class="boxTitle">vendor3</p>
<p class="boxDescription">Description of vendor3</p>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col col-sm-6 col-md-4">
<div class="result-padder">
<div class="box">
<p class="boxTitle">vendor4</p>
<p class="boxDescription">Description of vendor4</p>
</div>
</div>
</div>
<div class="col col-sm-6 col-md-4">
<div class="result-padder">
<div class="box">
<p class="boxTitle">vendor5</p>
<p class="boxDescription">Description of vendor5</p>
</div>
</div>
</div>
<div class="col col-sm-6 col-md-4">
<div class="result-padder">
<div class="box">
<p class="boxTitle">vendor6</p>
<p class="boxDescription">Description of vendor6</p>
</div>
</div>
</div>
</div>
</div>
The result is that the first row is set right but the second row comes out bad.
I want the spaces between all items to be the same, making it much more fluid.
Note: the heights of the items change all the time, so it has to work with all set of heights.
Take a look at it, you need to resize the result window to max in order to see the problem: http://jsfiddle.net/asafusan/09egpzkj/6/
How can I fix it?
I'm a rookie in programing so please explain extensively.
Thanks
i happen some time if you put less data then other so it become some irregular shape,
for this you have to give a fix height to your div, but it cause one issue that is it will be in same height in mobile or tablet as your applied,
so for this you have use media queries for mobile version
i am declaring another class that is grid, and give static height
Your code looks good, I would use a visual border to see the code. I created a mockup for you here
[http://www.bootply.com/Pzn15AfwyA][1]
.container {
border: 1px solid blue;
}
.result-padder {
border: 1px solid red;
margin-bottom: 10px;
}
<div class="wrapper">
<div class="container">
<div class="row">
<div class="col-md-4 col-lg-4">
<div class="result-padder">
<h1>vendor1</h1>
<p>Description of vendor1</p>
</div>
</div>
<div class="col-md-4 col-lg-4">
<div class="result-padder">
<h1>vendor1</h1>
<p>Description of vendor1</p>
</div>
</div>
<div class="col-md-4 col-lg-4">
<div class="result-padder">
<h1>vendor1</h1>
<p>Description of vendor1</p>
</div>
</div>
</div><!-- .row 1 -->
<div class="row">
<div class="col-md-4 col-lg-4">
<div class="result-padder">
<h1>vendor1</h1>
<p>Description of vendor1</p>
</div>
</div>
<div class="col-md-4 col-lg-4">
<div class="result-padder">
<h1>vendor1</h1>
<p>Description of vendor1</p>
</div>
</div>
<div class="col-md-4 col-lg-4">
<div class="result-padder">
<h1>vendor1</h1>
<p>Description of vendor1</p>
</div>
</div>
</div><!-- .row 2 -->
</div>
</div>
[1]: http://www.bootply.com/Pzn15AfwyA