I'm having an issue with an input inside a Bootstrap card. I want it to behave as the button on the second card, but somehow it shrinks and stays in-line. I tried adding some min-width or fixing its width but can't make it work with the responsive behaviour of the button that stacks on top of the other on certain screen width and also shrinks and expands.
Here is the code on Bootsnipp and a screenshot of the issue:
Edit: Adding my code in the post as requested: This is the first card, the one with the input.
<div class="col-sm-12 col-md-6 col-lg-4 col-xl-3">
<div class="card">
<img class="card-img-top" src="https://dummyimage.com/600x600/55595c/fff" alt="Card image cap">
<div class="card-body">
<h4 class="card-title">
Product title
</h4>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<div class="form-row">
<div class="col">
<select class="form-control btn-block">
<option>50</option>
<option>100</option>
<option>200</option>
<option>300</option>
<option>400</option>
<option>500</option>
<option>600</option>
</select>
</div>
<div class="col">
Add to cart
</div>
</div>
</div>
</div>
</div>
Just change the wrapper columns to col-12 use the 12 available ones, and add some margin bottom to the select with mb-3. The next code modification should work, i have tested it on your code:
<div class="form-row">
<div class="col-12 mb-3"> <!-- changes here ... -->
<select class="form-control btn-block">
<option>50</option>
<option>100</option>
<option>200</option>
<option>300</option>
<option>400</option>
<option>500</option>
<option>600</option>
</select>
</div>
<div class="col-12"> <!-- ... and here -->
Add to cart
</div>
</div>
Related
I have a form, I inserted a piece from the form where I use bootstrap.min.css col-lg-6
And now when the screen width is large, the first column with text will be on the left, and the button on the right
And when the width is small, let's say for mobile, then the column with the text will be on top, and the button will be on the bottom
I want to make things stay the same for large widths, text on the left, button on the right. And for mobile, I want it to be the other way around, the button is on top, and the text is on the bottom
So far, my only idea is to make 2 buttons, and hide the extra one depending on the screen size
But is there another way to do this?
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<div class="row">
<div class="col-md-6">
<form>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
asd
</div>
</div>
<div class="col-lg-6">
<button type="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
is the Boostrap version 3.2 mandatory in your project? Because in more recent versions of Bootstrap you could use the Order Classes for your task.
I used your code snippet once, using Bootstrap's Oder Classes:
<div class="row">
<div class="col-md-6">
<form>
<div class="row">
<div class="col-lg-6 order-2 order-md-1">
<div class="form-group">
asd
</div>
</div>
<div class="col-lg-6 order-1 order-md-2">
<button type="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
(see here online)
I want to create cards in a loop runtime but the card show vertically align eachother i gave the col-md-4 but it didnot work
enter code here
<div class="row-fluid border mt-3">
<div *ngFor="let data of allWidgets">
<div class="col-md-4 border mt-3">
<div class="card">
<div class="img1">
<img src="https://images.havenly.com/unsafe/550x334/filters:quality(50)/https://s3.amazonaws.com/static.havenly.com/assets/2a35d539-e889-405e-b495-815aa33f65ea" alt="">
</div>
<div class="img2">
<img src="https://images.havenly.com/unsafe/180x180/filters:quality(50)/https://s3.amazonaws.com/havenlydesignerphotos/13078-profile-eb69eheadshot02.jpg" alt="">
</div>
<div class="mian-text mt-0">
<p>{{data.name}}</p>
<p><small>{{data.description}} </small> </p>
View Profile <span style="color: lightgray;">|</span> Select Cherise
</div>
</div>
</div>
</div>
you must use the ngFor not on the first div but on the second like this :
<div class="col-md-4 border mt-3" *ngFor="let data of allWidgets">
this is the solution of your problem.
if you want to create a good angular card you must see:https://mdbootstrap.com/docs/angular/
is the most used site in angular.
have a nice day :)
I am still learning bootstrap and have gone a little far to create a page, I am stuck on 2 things, first one is the phone image at the top section, on my screen it is fine which is 24" with 1600 resolution, but on 15" lcd the phone cuts in half, can someone tell me what to do ? how to fix this ? secondly the images , sections look so magnified so big, does it have any fix ? should I place it in a container ?
Live page : https://babaraliseehar.com/chet/
I have created a single bootstrap page but I am having a little issue in responsiveness.
<section class="section hero-section position-relative" id="a">
<div class="container-fluid position-absolute h-100 hero-bg mob-hid">
<div class="row align-items-stretch h-100">
<div class="col-md-6 hero-left"> </div>
<div class="col-md-6 hero-right"> </div>
</div>
</div>
<!-- <div class="col-md-7 p-0 hero-left-img wow fadeInLeft mob-hid" data-wow-delay=".1s">
<img src="assets/images/front-left2.png" alt="">
</div> -->
<div class="col-12 p-0 hero-mob d-none m-block">
<img src="assets/images/front-left2.png" alt="">
</div>
<div class="container">
<div class="row align-items-stretch">
<div class="col-md-6 offset-md-7 hero-right-text wow fadeInRight" data-wow-delay=".3s" style="visibility: visible; animation-delay: 0.3s; animation-name: fadeInRight;">
<h1>Get better, together.</h1>
<p>A professional development social network <br> for today's audience: share what you are <br> doing, in the moment, to get better. </p>
<div id="form_first">
<div class="beta-available">
<p><strong>Join the list for the next beta release!</strong></p>
<form method="post">
<div class="form-bx">
<input type="email" name="email" class="input-bx input-brd txtEmail" placeholder="Email Address" id="txtEmail_first">
</div>
<div class="form-bx ">
<button type="submit" name="submit" class="btn button-blue btnValidate_first ">
<span class="">Sign Up</span>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
image is croped because you used background-size: cover;. if you don't want image to get cropped,
use:
background-size: contain;
also in your layout, image should be on right. so add:
background-position-x: right;
to your image as well.
Also if you want your image to crop, but you want the right side to be always visible, let it to be cover, and use background-position-x: right; to crop only left side.
I have the following page structure:
<div class="container">
<div class="row mb-5">
<div class="col-12 col-md-3">
<img class="mr-5 img-fluid" src="big_icon_1.png" alt="Big icon 1">
</div>
<div class-"col-12 col-md-9">
<h3 class="mt-0 mb-1 text-center text-md-left">Item 1</h3>
<p>This is item 1.</p>
</div>
</div>
<div class="row mb-5">
<div class="col-12 col-md-3">
<img class="mr-5 img-fluid" src="big_icon_2.png" alt="Big icon 2">
</div>
<div class-"col-12 col-md-9">
<h3 class="mt-0 mb-1 text-center text-md-left">Item 2</h3>
<p>This is item 2.</p>
</div>
</div>
</div>
What I am expecting is a column layout from the 'md' breakpoint up, and a stacked layout below that, and this is indeed what I'm getting. But the second 'col' is never extending to the right edge of the parent 'row' container and I do not understand why as all of the examples in the Bootstrap documentation show exactly that this should happen.
So my icon column is nicely set to 1/4 row width on a desktop and full width on mobile. But the column with heading and text is only ever as wide as its content, no matter what size the display. Of course, this makes the heading centring pointless.
What am I missing?
The source formatter on this website failed to catch this little gem, and my source editor has a very subtle colour difference that I hadn't noticed:
<div class-"col-12 col-md-9">
Which should, of course, be
<div class="col-12 col-md-9">
Time to change my editor colour scheme.
And, in fact, that line doesn't need the col-12 class in case anyone is looking. I only put it there in desperation.
I have a bootstrap grid system on my page and want two elements pulled to the right, but placed one below the other. This is the code I have right now. I want "Active" and "Primary" button place one below the other, but also pulled right. As of now, it looks like this:
If I were to add this to the button, then it aligns properly, but on mobile, it messes up.
<button type="button" class="btn btn-w-m btn-primary" style="margin-left: 261px;">Primary</button>
This is what I have so far. What can I do to achieve the desired result?
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row border-bottom white-bg dashboard-header">
<div class="col-md-3">
<h4>Dummy Name</h4>
<small>Dummy Street</small><br>
<small>Dummy Apt, Some City, Some State</small><br>
<small>United States</small><br>
</div>
<div class="col-md-3">
<h5>123-456-7890</h5>
</div>
<div class="col-md-3">
<h5>some_name#somecompany.com</h5>
</div>
<div class="col-md-3">
<h2 class="pull-right" style="margin-top: -5px">Active</h2><br>
<button type="button" class="btn btn-w-m btn-primary">Primary</button>
</div>
</div>
</div>
You do not need pull-right at all - all you need to right align the text of the heading and the button is text-align:right in the css or the text-right class on the parent div. Note that you need to open this snippet in "full screen mode due to the small size of the preview window.
I would also suggest that you put the css in its own style sheet rather than inline style rules. If you use text-align: right as a style rule then you can use a media query to apply it or left align on certain screen sizes as required.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row border-bottom white-bg dashboard-header">
<div class="col-xs-3 col-md-3">
<h4>Dummy Name</h4>
<small>Dummy Street</small><br>
<small>Dummy Apt, Some City, Some State</small><br>
<small>United States</small><br>
</div>
<div class="col-xs-3 col-md-3">
<h5>123-456-7890</h5>
</div>
<div class="col-xs-3 col-md-3">
<h5>some_name#somecompany.com</h5>
</div>
<div class="col-xs-3 col-md-3 text-right">
<h2>Active</h2><br>
<button type="button" class="btn btn-w-m btn-primary">Primary</button>
</div>
</div>
</div>
</div>