I'm using bootstrap on Codepen.io.
I have a page divided into 3 main divs. The middle div has 3 images and is divided into 3 columns.
Everything looks fine on desktop but once I resize the window, the bottom div overlaps the third image instead of moving to the bottom.
Is there a way to make bootstrap work its magic without changing CSS manually?
https://codepen.io/oldmanwithbeer/pen/ENzvoY?editors=1000#0
<div class="container-fluid">
<div class="row">
<div id="one" class="col-md-12">
<div id="btn_row" class="row">
<div class="col-md-12 text-center">
<button type="button" class="btn btn-primary">some text</button>
<button type="button" class="btn btn-primary">some text</button>
<button type="button" class="btn btn-primary">some text</button>
<button type="button" class="btn btn-primary">some text</button>
</div>
</div>
</div>
</div>
<div class="row">
<div id="two" class="col-md-12">
<h2>some text</h2>
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<a href="#" target="_blank">
<img class="img-responsive" src="#" alt="text"></a>
<div class="caption">some text</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<a href="#" target="_blank">
<img class="img-responsive" src="#" alt="text"></a>
<div class="caption">some text</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<a href="#" target="_blank">
<img class="img-responsive" src="#" alt="text"></a>
<div class="caption">some text</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div id="three" class="col-md-12"><h3>text</h3>
</div>
</div>
</div>
Actually for the proper responsive or mobile view developers use the css media query. If you look at the bootstrap doc then you may see the demonstration. Importantly you used fixed height in different elements like:
#portfolio {
height: 400px;
}
So I recommendation is to use css media query at the bottom of your stylesheet or style with auto height. Like this:
#media only screen and (max-width: 767px) {
#portfolio {
height: auto;
}
}
Hope it will do the magic ...
Related
This is my container. I think it looks really good, but it only shows one container on the right side, and I want it to show 3 side by side. How can I do this?
If I just copy and paste the code right beneath itself, the second container is underneath the first one.
<div class="container">
<div class="row">
<div class="col-sm">
<h2>Product 2</h2>
</div>
<br>
<br>
<div class="text-center">
<img src="https://picsum.photos/200" alt="..." class="img-thumbnail" />
</div>
<div class="text-center">
<button class="btn btn-primary btn-sx" type="button">Confirm</button>
</div>
</div>
</div>
Use the Bootstrap Grid!
To arrange any elements into a grid, use the Bootstrap grid system. Give the parent element the row class, and give any children the col class. This will make all the children elements share the parent horizontally.
<div class="row">
<div class="col">
<div class="col-sm">
<h2>Product 2</h2>
</div>
</div>
<div class="col">
<div class="text-center">
<img src="https://picsum.photos/200" alt="..." class="img-thumbnail">
</div>
</div>
<div class="col">
<div class="text-center">
<button class="btn btn-primary btn-sx" type="button">Confirm</button>
</div>
</div>
</div>
You could replace col with col-4, which would do almost the same thing, but would be more explicit.
You could add a breakpoint (like sm) to the class (so col-sm), to make it automatically wrap vertically when you resize the window to a certain breakpoint.
Learn all about the Bootstrap grid system here.
W3schools: https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_default&stacked=h
You try it:
<div class="row">
<div class="col-sm-4">
<h2>Product 2</h2>
</div>
<div class="col-sm-4">
<img src="https://picsum.photos/200" alt="..." class="img-thumbnail" />
</div>
<div class="col-sm-4">
<button class="btn btn-primary btn-sx" type="button">Confirm</button>
</div>
</div>
</div>
`
don't forget :
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
I want to put tooltip into an image that will display a small will screen with img, text, and able use HTML, CSS
I use boostrap and have no ideal what to do next :<
Something like this:
sample
This just part of the code.
<div class="carousel-inner">
<div class="carousel-item active">
<div class="container">
<div class="row">
<div class="col-md-12 align-content-center">
<div class="col-lg-12 text-center">
<h3 class="text-uppercase">Team of 2018-2019</h3>
</div>
<div class="team-memberpre">
<img class="mx-auto rounded-circle" src="...image...">
<h4>...name....</h4>
<p class="text-muted">President</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="team-member">
<img class="mx-auto rounded-circle" src="..image.." alt="">
<h5>...name....</h5>
<p class="text-muted">Lead Marketing</p>
</div>
</div>
</div>
</div>
</div>
Here's a jsfiddle exmaple
You can achieve image + text with popover with data-html="true" and data-content="html code"
your .html code
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-html="true" data-content='<div class="row">
<div class="col">
<img src="https://www.anime-planet.com/images/anime/covers/naruto-22.jpg" width=60 height=60 />
</div>
<div class="col">
<b>some</b> text here
</div>
</div>'>
Popover on with image and text
</button>
</div>
.js file
$(function() {
$('[data-toggle="popover"]').popover()
})
I am trying to create this:
I have the left and right image and the monkey image.
I was trying to create a row and make the left image col-3, the right image col-3 and the monkey and text col-6 in the middle.
Everything is stacking up on each other, comes out of the screen and not working. How can I make this sort of thing?
<section class="hero-area">
<div class="container-fluid">
<div class="row">
<div class="col-md-3 col-xs-3">
<img src="images/hero-left.svg" class="" alt="">
</div>
<div class="col-xs-6 col-md-126>
<h1 class="">
<b>monKey</b> Generator</h1>
<br>
<h2 class="">Generate a
<b>unique monkey</b> avatar
<br> from a
<b>Banano public key</b>
</h2>
<img src="https://bananomonkeys.herokuapp.com/image?address=ban_3tapge8i4kw9wa4irgda7epm4gaurr4rnp7ybjziphkt48afd6ba5pnaegs6"
class="" alt="">
</div>
<div class="col-md-3 col-sm-3">
<img src="images/hero-right.svg" class="" alt="">
</div>
</div>
</div>
</section>
There are couple of typos in your snippet above eg: col-md-126 and missing " after that. Also bootstrap 4 does not have xs on cols so using just col-3 col-6 col-3 would do the job.
See the snippet below.
img {
width:100%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<section class="hero-area">
<div class="container-fluid">
<div class="row">
<div class="col-3">
<img src="images/hero-left.svg" alt="monkey left">
</div>
<div class="col-6">
<h1>
<b>monKey</b> Generator
</h1>
<br>
<h2>Generate a
<b>unique monkey</b> avatar
<br> from a
<b>Banano public key</b>
</h2>
<img src="https://bananomonkeys.herokuapp.com/image?address=ban_3tapge8i4kw9wa4irgda7epm4gaurr4rnp7ybjziphkt48afd6ba5pnaegs6" />
</div>
<div class="col-3">
<img src="images/hero-right.svg" class="" alt="monkey right">
</div>
</div>
</div>
</section>
I'm using bootstrap cards to build this layout on desktop:
So far so good, at this width everything is ok as well:
But from this width to desktop width the container is not filled:
The HTML to build the card with the images is:
<div class="card h-60">
<div>
<div class="row box">
<div class="box-content formal">
<div class="col-md-12">
<img class="imageban" src="img/crm.png" />
<span><b>CRM</b></span>
</div>
</div>
<div class="box-right">
<a href="#">
<img class="img-responsive" src="img/img1.jpg"/>
</a>
</div>
</div>
</div>
<div>
<div class="row box">
<div class="box-content report">
<div class="col-md-12">
<img class="imageban" src="img/report.png" />
<span><b>Report</b></span>
</div>
</div>
<div class="box-right">
<a href="#">
<img class="imageban" src="img/img4.jpg"/>
</a>
</div>
</div>
</div>
<div>
<div class="row box">
<div class="box-content formal">
<div class="col-md-12">
<img class="img-responsive" src="img/formal_notices.png" />
<span><b>Formal Notices</b></span>
</div>
</div>
<div class="box-content text">
<a href="#">
Open the Formal <br>Notice Document <br>Library
</a>
</div>
</div>
</div>
</div>
And the CSS is only this line:
.row.box{
max-width: 345px;
}
I'm stuck in this, any help would be nice. Thanks.
You can remove the class .box and use the Bootstrap classes instead col-md-4 col-xs-12.
I'm practicing bootstrap buttons.
I've written the following code
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-5">
<button class="btn btn-success performanceButton">Best case performance</button>
</div>
<div class="col-md-6"> </div>
</div>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-5">
<button class="btn btn-warning performanceButton">Average case performance </button>
</div>
<div class="col-md-6"> </div>
</div>
The code is working well, but when I test it for small screen size by downsizing the browser it seems that the text in the second button expands out of the button.
Here is a screen capture of the issue.
Does anyone know how to solve this please ? Thank you in advance :)
You need to make your columns bigger for smaller screens, try this:
<div class="row">
<div class="col-md-1"></div>
<div class="col-sm-8 col-md-5">
<button class="btn btn-success performanceButton">Best case performance</button>
</div>
<div class="col-sm-3 col-md-6"> </div>
</div>
<div class="row">
<div class="col-sm-1 col-md-1"></div>
<div class="col-sm-8 col-md-5">
<button class="btn btn-warning performanceButton">Average case performance </button>
</div>
<div class="col-sm-3 col-md-6"> </div>
</div>
By giving min-width property to your button, it won't break.
button {
min-width: 200px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-5">
<button class="btn btn-success performanceButton">Best case performance</button>
</div>
<div class="col-md-6"> </div>
</div>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-5">
<button class="btn btn-warning performanceButton">Average case performance </button>
</div>
<div class="col-md-6"> </div>
</div>
you can also make the text of button wrap instead of making button larger
just jive button a class like and in css
.wrapit{
width: 30px;
white-space: normal;
word-Wrap: break-word;
}