How to put image and text into tooltip? - html

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()
})

Related

Bootstrap Gridsystem col is not Working Properly

Here is my code:
I've tried change container class to container-fluid also resize the page.
<div class="container">
<div class="row">
<!--Product: banana split-->
<div class="col">
<div class="card" style="width: 20rem;">
<img class="card-img-top" src="img/banana-split.png" alt="Banana Split Image">
<div class="card-block">
<h4 class="card-title">Banana Split</h4>
<p class="card-text">Price: 5$</p>
<i class="fas fa-shopping-cart"></i> Add to Cart
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 20rem;">
<img class="card-img-top" src="img/bengala-doce.png" alt="Bengala Doce Image">
<div class="card-block">
<h4 class="card-title">Doce Natalino</h4>
<p class="card-text">Price: 2$</p>
<i class="fas fa-shopping-cart"></i> Add to Cart
</div>
</div>
</div>
</div>
</div>
The problem is the second col is not being placed side by side. It's being placed below each other.
I looked up on the console and there's not any warning.
Others stuff like bootstrap buttons is working fine.
You forgot to set your column classes depending on screen sizes you are viewing. This way, making 2 columns on mediums screen sizes, and on column in small screens using col-md-6 col-sm-12
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div class="container">
<div class="row">
<!--Product: banana split-->
<div class="col-md-6 col-sm-12">
<div class="card" style="width: 20rem;">
<img class="card-img-top" src="img/banana-split.png" alt="Banana Split Image">
<div class="card-block">
<h4 class="card-title">Banana Split</h4>
<p class="card-text">Price: 5$</p>
<i class="fas fa-shopping-cart"></i> Add to Cart
</div>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="card" style="width: 20rem;">
<img class="card-img-top" src="img/bengala-doce.png" alt="Bengala Doce Image">
<div class="card-block">
<h4 class="card-title">Doce Natalino</h4>
<p class="card-text">Price: 2$</p>
<i class="fas fa-shopping-cart"></i> Add to Cart
</div>
</div>
</div>
</div>
</div>

Why a row is stacked in column

I have used bootstrap for my website, simply put there are two column enclosed in col-md-12, they are col-md-6,
They should not be collapsing because enough space is given, why is this happening?
<div class="container-fluid" style="margin: 0">
<div class="row">
<div class="col-md-12">
<div class="col-md-6 ">
<div class="col-sm-12">
<img class="centering newReq" src="add-512.png" height="132" width="142">
</div>
<div class="col-sm-12">
<button type="button" class="btn btn-warning centering btnAdjust">New Request</button>
</div>
</div>
<div class="col-md-6 ">
<div class="col-sm-12">
<img class="centering newReq" src="contact.png" height="132" width="142">
</div>
<div class="col-sm-12">
<button type="button" class="btn btn-warning centering btnAdjust">My request</button>
</div>
</div>
</div>
</div>
</div>
Just remove the col-md-12 because each row contains each column. Optionally try to use
img-responsive class instead of setting width and height for image.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container-fluid" style="margin: 0">
<div class="row">
<div class="col-md-6 ">
<div class="col-sm-12">
<img class="centering newReq img-responsive" src="https://via.placeholder.com/150" height="132" width="142">
</div>
<div class="col-sm-12">
<button type="button" class="btn btn-warning centering btnAdjust">New Request</button>
</div>
</div>
<div class="col-md-6 ">
<div class="col-sm-12">
<img class="centering newReq img-responsive" src="https://via.placeholder.com/150" height="132" width="142">
</div>
<div class="col-sm-12">
<button type="button" class="btn btn-warning centering btnAdjust">My request</button>
</div>
</div>
</div>
</div>

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>

Adding a View All button to a website section and styling it

I am learning to create a website by downloading and editing contents.
I have created a section in the home page which shows the images of all stores of a shop. I need to display 3 stores image on the home page and add a View all button in the right bottom side of the section.
I have tried many ways but can't get it done in a good way.
Below is the HTML Code :
<!-- OUR STORES Section -->
<section id="stores" class="bg-light-gray">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Our Stores</h2>
</div>
</div>
<div class="row">
<div class="col-md-4 col-sm-6 portfolio-item">
<a href="#storeModal1" class="store-link" data-toggle="modal">
<div class="store-hover">
<div class="store-hover-content">
<i class="fa fa-plus fa-3x"></i>
</div>
</div>
<img src="img/store/store01.png" class="img-responsive" alt="">
</a>
<div class="store-caption">
<h4>Store 01</h4>
<p class="text-muted">Location 01</p>
</div>
</div>
<div class="col-md-4 col-sm-6 store-item">
<a href="#storeModal2" class="store-link" data-toggle="modal">
<div class="store-hover">
<div class="store-hover-content">
<i class="fa fa-plus fa-3x"></i>
</div>
</div>
<img src="img/store/store02.png" class="img-responsive" alt="">
</a>
<div class="store-caption">
<h4>Store 02</h4>
<p class="text-muted">Location 02</p>
</div>
</div>
</div>
</div>
</section>
Why not just adding a new row, text aligned to right with the button ?
edit: See other response, this one only tell how to add the HTML button, not the javascript of it.
<!-- OUR STORES Section -->
<section id="stores" class="bg-light-gray">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Our Stores</h2>
</div>
</div>
<div class="row">
<div class="col-md-4 col-sm-6 portfolio-item">
<a href="#storeModal1" class="store-link" data-toggle="modal">
<div class="store-hover">
<div class="store-hover-content">
<i class="fa fa-plus fa-3x"></i>
</div>
</div>
<img src="img/store/store01.png" class="img-responsive" alt="">
</a>
<div class="store-caption">
<h4>Store 01</h4>
<p class="text-muted">Location 01</p>
</div>
</div>
<div class="col-md-4 col-sm-6 store-item">
<a href="#storeModal2" class="store-link" data-toggle="modal">
<div class="store-hover">
<div class="store-hover-content">
<i class="fa fa-plus fa-3x"></i>
</div>
</div>
<img src="img/store/store02.png" class="img-responsive" alt="">
</a>
<div class="store-caption">
<h4>Store 02</h4>
<p class="text-muted">Location 02</p>
</div>
</div>
</div>
<!-- HERE -->
<div class="row">
<div class="col-md-12 text-right">
<button class="btn btn-primary">View All</button>
</div>
</div>
</div>
</section>
If you don't want to load them asynchronously (resp. you have them in HTML file already) you can wrap them into div, which is set as a hidden in css display:none
Then you need Javascript and create event which handles DOM interaction on click.
I made a little sample for you with CSS and jQuery (Javascript Framework):
https://jsfiddle.net/ta53jfwo/
I hope it helps!

How to force div to be bottom using bootstrap

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 ...