Bootstrap list of thumbnails leaves empty columns - html

I am trying to make a list of images with titles using Bootstrap 3.3.7, like an image gallery and I am getting this weird behaviour
I am using an unordered list-group and for every image a list-group-item:
<section>
<div class="content container">
<div class="control row">
<div class="col-md-12">
<button class="btn btn-success btn-lg" data-toggle="modal" data-target="#myModal">Upload</button>
</div>
</div>
<ul class="list-group row">
{{#each pictures}}
<li class="list-group-item col-md-3 col-xs-6 col-sm-6">
<div class="thumbnail">
<img src="{{path}}" alt="imagefail" style="width:100%">
<div>
<h3 style="">{{title}}</h3>
<button class="copyButton btn btn-primary btn-block"><i class="fa fa-clipboard" aria-hidden="true"></i>&#160Copy</button>
<button class="deleteButton btn btn-danger btn-block"><i class="fa fa-trash-o" aria-hidden="true"></i>&#160Delete</button>
</div>
</div>
</li>
{{/each}}
</ul>
</div>
</section>
I tried using a div.row instead of unordered list and for every image a div.col-md-3 and it has the same result:
<div class="row">
{{#each pictures}}
<div class="list-group-item col-md-3 col-xs-6 col-sm-6">
....
</div>
{{/each}}
</div>
Do you know any solution that does not require using a row for every 4 columns?

Fix the height of the images and it will work fine.
<div class="row">
{{#each pictures}}
<div class="col-md-3 col-xs-6 col-sm-6">
<img src="{{path}}" alt="imagefail" style="width:100%; height:200px">
</div>
{{/each}}
</div>

Related

Bootsrap 4 Grid or Flex

I have a form that looks like the following:
<div class="row">
<div class="col">
<textarea name="comment" class='form-control' placeholder='Type new comment here..'></textarea>
</div>
<div class="col">
<div class="row">
<div class="col">
<button class="btn btn-secondary btn-sm" type='button'><span class="fa fa-times mr5"></span>Cancel</button>
</div>
</div>
<div class="row">
<div class="col">
<button class="btn btn-primary btn-sm mt5" name='new_comment' type='submit'><span class="fa fa-plus mr5"></span>Save</button>
</div>
</div>
</div>
</div>
I'm using Bootstrap 4. The thing is, I want this form to be the max width of its container - to have the textarea stretch and the buttons be a static width. If I use the above, I get a big empty gap because the smallest col (col-1) is to wide for the buttons. How can I have it fill the width of the screen with the button columns remaining a fixed width?
I have a feeling its using flex and d-flex but I cant manage to get it work.
add flex-grow-0 to buttons column:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" >
<div class="container-fluid">
<div class="row">
<div class="col">
<textarea name="comment" class='form-control' placeholder='Type new comment here..'></textarea>
</div>
<div class="col flex-grow-0">
<div class="row">
<div class="col">
<button class="btn btn-secondary btn-sm" type='button'><span class="fa fa-times mr5"></span>Cancel</button>
</div>
</div>
<div class="row">
<div class="col">
<button class="btn btn-primary btn-sm mt5" name='new_comment' type='submit'><span class="fa fa-plus mr5"></span>Save</button>
</div>
</div>
</div>
</div>
</div>
You can remove .col and use d-flex and flex-grow-1.
Then, you can also add a margin-left using ml-3 to the buttons.
<div class="row mw-100">
<div class="d-flex flex-grow-1">
<textarea name="comment" class='form-control' placeholder='Type new comment here..'></textarea>
</div>
<div class="ml-3">
<div class="row">
<div class="col">
<button class="btn btn-secondary btn-sm" type='button'><span class="fa fa-times mr5"></span>Cancel</button>
</div>
</div>
<div class="row">
<div class="col">
<button class="btn btn-primary btn-sm mt5" name='new_comment' type='submit'><span class="fa fa-plus mr5"></span>Save</button>
</div>
</div>
</div>
</div>
For the buttons container, you can set the width you want.

how to center all the elements center in the html body with responsive

enter image description herehow to center all the elements center in the html body with responsive.i want all three elements in center of the body which are shown in the image.Am using bootstrap frame.
<div class="container-fluid">
<div class="col-md-4">
<img src="img/quote.png" class="img-responsive wow animated zoomIn">
</div>
<div class="col-md-6 text-center main-img">
<img src="img/main.jpg" class="homeimg img-responsive wow animated zoomIn">
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#myModal" data-backdrop="static" data-keyboard="false">Go to Website</button>
</div>
</div>
enter image description here
Have a look at this - https://plnkr.co/edit/ABOpqjxWw2ZvGiMiy53O?p=preview
Since you're using bootstrap cols, adding an offset col-md-offset-4 will help do the job.
You can a div class row to align the grid to the center of the page
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<img src="img/quote.png" class="img-responsive wow animated zoomIn">
</div>
<div class="col-md-6 text-center main-img">
<img src="img/main.jpg" class="homeimg img-responsive wow animated zoomIn">
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#myModal" data-backdrop="static" data-keyboard="false">Go to Website</button>
</div>
</div>
</div>
You can try like this:
<div class="container-fluid">
<div class="container">
<div class="row">
<div class="col-md-4">
<img src="img/quote.png" class="img-responsive wow animated zoomIn">
</div>
<div class="col-md-6 text-center main-img">
<img src="img/main.jpg" class="homeimg img-responsive wow animated zoomIn">
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#myModal" data-backdrop="static" data-keyboard="false">Go to Website</button>
</div>
</div>
</div>
</div>

put component on side of search field

I am developing a web application and would like my EntreCadastre-se|Carrinho menu to be next to the text field, but it is getting underneath
<div class="row">
<div class="col-6 col-md-4 col-xs-4">
<img src="imagens/eccomerce.JPG" alt="principal" id="imagem_principal">
</div>
<div class="col-6 col-md-4">
<div class="busca"><input type="text" id="campo_busca" placeholder="O que vocĂȘ procura?"><button type="submit" onclick="" class="buscar_produto "><i class="fa fa-search" action="" ></i></button> </div>
</div>
<div class="col-6 col-md-4">
<ul class="menu_2">
<div class="btn-group" role="group">
<div class="btn-group" role="group">
Entre/Cadastre-se <span class="caret"></span>
</div>
<button type="button" class="carrinho btn btn-default">Carrinho <i class="fa fa-shopping-cart"></i> ( )</button>
</div>
</ul>
</div>
</div>
What you are doing wrong here is your math. Like #efkin said you have only 12 columns. But you have defined three divs with col-6. That means 3*6 = 18.
When you want 3 columns with equal size on one row you have to use col-4 for each, because 3*4 = 12.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-4 col-md-4 col-xs-4">
<img src="imagens/eccomerce.JPG" alt="principal" id="imagem_principal" >
</div>
<div class="col-4 col-md-4">
<div class="busca"><input type="text" id="campo_busca" placeholder="O que vocĂȘ procura?"><button type="submit" onclick="" class="buscar_produto "><i class="fa fa-search" action="" ></i></button> </div>
</div>
<div class="col-4 col-md-4">
<ul class="menu_2">
<div class="btn-group" role="group">
<div class="btn-group" role="group">
Entre/Cadastre-se <span class="caret"></span>
</div>
<button type="button" class="carrinho btn btn-default">Carrinho <i class="fa fa-shopping-cart"></i> ( )</button>
</div>
</ul>
</div>
</div>

Horizontal line in a Jumbotron

I don't feel well. All of a sudden, an unwanted white horizontal line has appeared in the bottom of my jumbotron. It's happened after...
Inserting a navbar form
Adding a form at the bottom of the body
Inserting a object then
inserting a button in the jumbotron
I've commented out all changes I've made, but to no avail.
<header class="jumbotron">
<!-- Main component for a primary marketing message or call to action -->
<div class="container">
<div class="row row-content">
<div class="col-xs-12 col-sm-8">
<h1>Ristorante con Fusion</h1>
<p style="padding:40px;"></p>
<p>We take inspiration from the World's best cuisines!</p>
</div>
<div class="col-xs-12 col-sm-2">
<p style="padding:20px;"></p>
<img src="img/logo.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-2">
<br><br><br><br><br>
<button type="button" class="btn btn-warning btn-lg btn-block" onclick="window.location.href='#reservation'">Reserve table</button>
</div>
</div>
</div>
</header>
<header class="jumbotron" style="margin-bottom:0px">
<!-- Main component for a primary marketing message or call to action -->
<div class="container">
<div class="row row-content">
<div class="col-xs-12 col-sm-8">
<h1>Ristorante con Fusion</h1>
<p style="padding:40px;"></p>
<p>We take inspiration from the World's best cuisines!</p>
</div>
<div class="col-xs-12 col-sm-2">
<p style="padding:20px;"></p>
<img src="img/logo.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-2">
<br><br><br><br><br>
<button type="button" class="btn btn-warning btn-lg btn-block" onclick="window.location.href='#reservation'">Reserve table</button>
</div>
</div>
</div>
Found it! You can relax everyone...
<div class="row row-content">
should have been
<div class="row row-header">

Align responsive text

I am trying to align the my icon's text to be on the same level. However, they are distorted when the window is resized bigger as shown in the fiddle. How can I make them to be beside each other?
Here's my fiddle:
https://jsfiddle.net/whywymam/72qp7c6L/
My HTML:
<div id="btnTopInline">
<ul class= "nav navbar-nav navbar-right hidden-xs">
<div class="col-sm-3 col-md-3 col-lg-3">
<li>
<div class="indivColl">
<a href="signupLogin.php">
<img src="https://i.stack.imgur.com/pBLqM.png" class="indi">
<p class="indit">Job Seeker</p>
</a>
</div>
</li>
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
<li>
<div class="empColl">
<a href="signupLoginEmp.php">
<img src="https://i.stack.imgur.com/Dbaoj.png" class="emp">
<p class="empt">Employer</p>
</a>
</div>
</li>
</div>
<div class="clearfix visible-md-block"></div>
<div class="clearfix visible-sm-block"></div>
<div class="clearfix visible-lg-block"></div>
</ul>
</div><!-- end btnTopInline -->
<div class="col-xs-2 col-xs-push-6 padBtnRight">
<button type="button" class="btn btn-login visible-xs">
<a href="signupLogin.php">
Job Seeker<br>Log In
</a>
</button>
</div>
<div class="col-xs-2 col-xs-push-7">
<button type="button" class="btn btn-login visible-xs">
<a href="signupLoginEmp.php">
Employer<br>Log In
</a>
</button>
</div>
<div class="clearfix visible-xs-block"></div>