text does not want to be under the image. using bootstrap - html

Hi guys do you know how to make this text under the image. i've tried use absolute on the text and it's work but when i test the responsive text gonna be the bottom of content not under the picture.
#sorryforbadenglish
.fitur {
padding: 15px 0;
text-align: center;
}
.fitur .btn-get-started {
font-family: "Roboto", sans-serif;
text-transform: uppercase;
font-weight: 500;
font-size: 14px;
letter-spacing: 1px;
display: inline-block;
padding: 10px 28px;
border-radius: 4px;
transition: 0.5s;
color: #fff;
background-image: url("../img/gplay.png");
background-size: cover;
width: 210px;
height: 61px;
}
.fitur .col-half-offset {
margin-left: 4.166666667%
}
.fitur p.sub {
font-size: 16px;
font-family: "Ubuntu", sans-serif;
font-weight: 700;
}
.fitur img {
max-width: 200%;
transition: all 0.4s ease-in-out;
display: inline-block;
padding: 15px 0;
}
.fitur img:hover {
transform: scale(1.15);
}
#media (max-width: 768px) {
.fitur img {
max-width: 100%;
}
}
#media (min-width: 1024px) {}
#media (max-width: 500px) {}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<section id="fitur" class="fitur section-bg">
<div class="container" data-aos="zoom-in">
<div class="section-title">
<p style="margin-top: 100px;">Fitur</p>
<h3>Aplikasi</h3>
</div>
<div class="row">
<div class="col-lg-2 d-flex align-items-center justify-content-center">
<img src="assets/img/aplikasi/01.png" class="img-fluid" alt="">
<p class="sub">Jual Sampah</p>
</div>
<div class="col-lg-2 col-half-offset d-flex align-items-center justify-content-center">
<img src="assets/img/aplikasi/02.png" class="img-fluid" alt="">
<p class="sub">Harga Real Time</p>
</div>
<div class="col-lg-2 col-half-offset d-flex align-items-center justify-content-center">
<img src="assets/img/aplikasi/05.png" class="img-fluid" alt="">
<p class="sub">Transaksi Terdata</p>
</div>
<div class="col-lg-2 col-half-offset d-flex align-items-center justify-content-center">
<img src="assets/img/aplikasi/06.png" class="img-fluid" alt="">
<p class="sub">Layanan Komunikasi</p>
</div>
<div class="col-lg-2 col-half-offset d-flex align-items-center justify-content-center">
<img src="assets/img/aplikasi/07.png" class="img-fluid" alt="">
<p class="sub">Rangkuman Transaksi</p>
</div>
</div>
<div class="d-flex">
</div>
</div>
</section>
the result is :
The text is next to the image, can you help me how to take it under the image ?

Add flex-column to the parent div which contains the image and text. Like this
<div class="col-lg-2 d-flex align-items-center justify-content-center flex-column">
<img src="assets/img/aplikasi/01.png" class="img-fluid" alt="">
<p class="sub">Jual Sampah</p>
</div>
By default the flex direction is row and it needs to be set to column so that the image and text are stacked on top of each other

Related

Text does not appear when hovering over image

When you hover over the image, the place where it should go down from top to bottom does not work and the image does not grow when I hover over it.
Here I want the place labeled "downmen" to go down with a top-down effect. At the same time I want the picture I hover over to grow a little.
As a result, when both hover over the image, I want one to go down from the top and the other to make the image grow.
Note I used bootstrap 5 while doing these.
.section-two-card-inner-two {
position: relative;
}
.section-two-card-inner-two .downmen {
display: none;
position: absolute;
z-index: 1;
width: 100%;
height: 110px;
padding: 2% 10%;
}
.section-two-card-inner-two:hover .downmen {
display: block;
}
.section-two-card-inner-two .downmen img {
height: 55px;
}
.card-title-head {
padding-top: 100px;
}
.section-two-card-inner-two a {
padding-top: 15%;
}
.section-two-card .card-title {
font-weight: 600;
font-family: 'Manrope', sans-serif;
font-size: 1.3rem;
line-height: 26px;
}
.section-two-card .card-text {
font-weight: 700;
font-family: 'League Spartan', sans-serif;
font-size: 26px;
line-height: 30px;
}
.section-two-card .card-text:hover {
color: #ccc;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.1/css/bootstrap-grid.min.css" />
<div class="row row-cols-1 row-cols-lg-2 section-two-card m-0">
<div class="col p-2 section-two-card-inner ">
<div class="card bg-dark text-white section-two-card-inner-two ">
<div class="downmen d-flex text-secondary align-items-center ">
<img src="https://picsum.photos/seed/picsum/55" alt=".." class="img-fluid rounded-circle me-3">
<div class="col-10">
<h4 class="fw-normal">Posted by <strong>admin</strong></h4>
<h4 class="fw-normal">August 27, 2025</h4>
</div>
</div>
<img src="https://picsum.photos/500" alt="" class="rounded-4 border-0 img-fluid">
<div class="card-img-overlay p-4 p-sm-5 border border-0 ">
<div class="d-flex card-title-head">
<h5 class="card-title text-secondary">Most Read </h5>
<h4 class="card-title ms-3"><i class="bi bi-clock fs-5 text-white me-2"></i> 6 min read</h4>
</div>
<p class="card-text">This will help you become the first and strengthen your position</p>
Read More <i class="bi bi-arrow-right ms-2 fs-4"></i>
</div>
</div>
</div>
</div>
Your example provides everything you need. Just use your browser to inspect the initial state of the relevant elements (.card_post) and that after forcing hover on .item-wrapper.
The only lingering issue is that the hover state is triggered on an element which is larger than the image. That could be refined with layout adjustments.
.section-two-card-inner-two {
position: relative;
overflow: hidden; /* new */
}
.section-two-card-inner-two img {
transition: all cubic-bezier(0.4, 0, 0.2, 1) 0.4s; /* new */
}
.section-two-card-inner-two:hover img {
transform: scale(1.1); /* new */
}
.section-two-card-inner-two .downmen {
opacity: 0; /* new */
transform: translateY(-10px); /* new */
transition: all cubic-bezier(0.4, 0, 0.2, 1) 0.4s; /* new */
position: absolute;
z-index: 1;
width: 100%;
height: 110px;
padding: 2% 10%;
}
.section-two-card-inner-two:hover .downmen {
opacity: 1; /* new */
transform: translateY(0); /* new */
}
.section-two-card-inner-two .downmen img {
height: 55px;
}
.card-title-head {
padding-top: 100px;
}
.section-two-card-inner-two a {
padding-top: 15%;
}
.section-two-card .card-title {
font-weight: 600;
font-family: 'Manrope', sans-serif;
font-size: 1.3rem;
line-height: 26px;
}
.section-two-card .card-text {
font-weight: 700;
font-family: 'League Spartan', sans-serif;
font-size: 26px;
line-height: 30px;
}
.section-two-card .card-text:hover {
color: #ccc;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.1/css/bootstrap-grid.min.css" />
<div class="row row-cols-1 row-cols-lg-2 section-two-card m-0">
<div class="col p-2 section-two-card-inner ">
<div class="card bg-dark text-white section-two-card-inner-two ">
<div class="downmen d-flex text-secondary align-items-center ">
<img src="https://picsum.photos/seed/picsum/55" alt=".." class="img-fluid rounded-circle me-3">
<div class="col-10">
<h4 class="fw-normal">Posted by <strong>admin</strong></h4>
<h4 class="fw-normal">August 27, 2025</h4>
</div>
</div>
<img src="https://picsum.photos/500" alt="" class="rounded-4 border-0 img-fluid">
<div class="card-img-overlay p-4 p-sm-5 border border-0 ">
<div class="d-flex card-title-head">
<h5 class="card-title text-secondary">Most Read </h5>
<h4 class="card-title ms-3"><i class="bi bi-clock fs-5 text-white me-2"></i> 6 min read</h4>
</div>
<p class="card-text">This will help you become the first and strengthen your position</p>
Read More <i class="bi bi-arrow-right ms-2 fs-4"></i>
</div>
</div>
</div>
</div>

Bootstrap Flexbox horizontal scrolling element not workin

I have written some CSS and used bootstrap to create a horizontal div with scroll ability but the output is not proper if I add
<meta name="viewport" content="width=device-width, initial-scale=1">
In My Code
Code Output
My Code:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<style>
::-webkit-scrollbar {
width: 1px;
height: 0px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
.scrolling-wrapper{
overflow-x: auto;
}
.card-block{
height: 200px;
width: 163px;
background-color: #141414;
border: none;
background-position: center;
background-size: cover;
transition: all 0.2s ease-in-out !important;
border-radius: 8px;
}
.card-block img{
display: block;
border-radius: 50%;
height: 82px;
width: 82px;
margin-left: auto;
margin-right: auto;
margin-top: 20px;
}
.card-block span{
display: block;
font-size: 18px;
color: #fff;
margin-top: 4px;
margin-left: auto;
margin-right: auto;
}
.card-block a{
background-color: #007bdc;
padding-left: 4px;
padding-right: 4px;
padding-top: 2px;
padding-bottom: 2px;
margin-right: auto;
margin-left: auto;
text-decoration: none;
color: #fff;
font-size: 12px;
border-radius: 4px;
margin-top: 12px;
}
</style>
<div class="scrolling-wrapper row flex-row flex-nowrap mt-6 pb-6 pt-3">
<div class="col-2">
<div class="card card-block card-1">
<img src="http://placehold.it/80x80">
<span>
Om Prakash
</span>
<a href="#">
More Info
</a>
</div>
</div>
<div class="col-2">
<div class="card card-block card-2">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-3">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-4">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-5">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-6">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-7">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-8">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-9">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-2">
<div class="card card-block card-10">
<img src="http://placehold.it/80x80">
</div>
</div>
</div>
<br/>
<br/>
<br/>
try using col-auto instead of col-2 and mx-0 with row
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<style>
::-webkit-scrollbar {
width: 1px;
height: 0px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
.scrolling-wrapper{
overflow-x: auto;
}
.card-block{
height: 200px;
width: 163px;
background-color: #141414;
border: none;
background-position: center;
background-size: cover;
transition: all 0.2s ease-in-out !important;
border-radius: 8px;
}
.card-block img{
display: block;
border-radius: 50%;
height: 82px;
width: 82px;
margin-left: auto;
margin-right: auto;
margin-top: 20px;
}
.card-block span{
display: block;
font-size: 18px;
color: #fff;
margin-top: 4px;
margin-left: auto;
margin-right: auto;
}
.card-block a{
background-color: #007bdc;
padding-left: 4px;
padding-right: 4px;
padding-top: 2px;
padding-bottom: 2px;
margin-right: auto;
margin-left: auto;
text-decoration: none;
color: #fff;
font-size: 12px;
border-radius: 4px;
margin-top: 12px;
}
</style>
<div class="scrolling-wrapper row mx-0 flex-nowrap mt-6 pt-3">
<div class="col-auto">
<div class="card card-block card-1">
<img src="http://placehold.it/80x80">
<span>
Om Prakash
</span>
<a href="#">
More Info
</a>
</div>
</div>
<div class="col-auto">
<div class="card card-block card-2">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-3">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-4">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-5">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-6">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-7">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-8">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-9">
<img src="http://placehold.it/80x80">
</div>
</div>
<div class="col-auto">
<div class="card card-block card-10">
<img src="http://placehold.it/80x80">
</div>
</div>
</div>
<br/>
<div> <p>Hello I'm a Text</p></div>
<br/>
<br/>

I am making a website using bootstrap, I have made the card responsive but i can't make the image in the card responsive

This is My Format right now on phone/dekstop
++img++ ++Title++
++SNIPPET++
I want to create it in such a way that it looks like this on phone
++img++
++Title++
++Snippet++
This is how i want to design in the card but i don't know how
This is The HTML code I am making this project on django so ignore this part {}
{% for post in object_list %}
{% if post.header_image %}
<div class="container-fluid col-xs-12 col-sm-12 col-md-9 col-lg-9 col-xl-10 " onclick="location.href='{%url 'article-details' post.pk %}';" style="cursor: pointer;">
<div class="row">
<div class="col-12 mt-3">
<div class="card ">
<div class="card-horizontal">
<div class="img-square-wrapper col-sm-4">
<img class="responsive" src="{{post.header_image.url}}" alt="Card image cap">
</div>
<div class="card-body">
<h4 class="card-title"> {{post.title}}</h4>
<p class="card-text">{{post.snippets}}</p>
</div>
</div>
<div class="card-footer">
<small class="text-muted">{{post.post_date}}</small>
</div>
</div>
</div>
</div>
</div>
{%endif%}
{% endfor %}
THIS the CSS part I have been trying all sorts of thing but its not happening, I dont know know what to do.
.item{
margin: auto;
padding:auto;
}
.flex-container-center {
justify-content: center;
}
.text{
padding: 5px;
text-align: center;
color: black;
}
.text2{
color: black;
}
.list-col *{
padding-top: 5px;
margin-left: 10px;
margin-right: 10px;
outline: 5px black;
}
.card-horizontal {
display: flex;
flex: 1 1 auto;
}
.card-horizontal:hover{
border: 1px solid #777;
}
img {
border: 1% solid #ccc;
display: block;
margin-left: 10%;
width: 100%;
height: auto;
}
img:hover{
border: 1% solid #777;
}
.responsive{
width: 100%;
height: 300px;
object-fit: cover;
object-position: bottom;
}
Rendered in desktop:
Rendered on Mobile:
Can anyone help me to understand what is wrong with my code?
Here It is, I removed unnecessary classes from styles.
Used col-md-4 and w-100
.item{
margin: auto;
padding:auto;
}
.flex-container-center {
justify-content: center;
}
.text{
padding: 5px;
text-align: center;
color: black;
}
.text2{
color: black;
}
a{
text-decoration: none !important;
}
.list-col *{
padding-top: 5px;
margin-left: 10px;
margin-right: 10px;
outline: 5px black;
}
.card:hover{
border: 1px solid #777;
}
img:hover{
border: 1% solid #777;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<div class="container-fluid col-xs-12 col-sm-12 col-md-9 col-lg-9 col-xl-10 " onclick="location.href='#';" style="cursor: pointer;">
<div class="row">
<div class="col-12 mt-3">
<div class="card ">
<div class="card-horizontal row">
<div class="img-square-wrapper col-md-4">
<img class="w-100" src="https://via.placeholder.com/150C/O" alt="Card image cap">
</div>
<div class="card-body">
<a href="#">
<h4 class="card-title"> Title</h4>
</a>
<p class="card-text">Lorem Epsum</p>
</div>
</div>
<div class="card-footer">
<small class="text-muted">11-02-2021</small>
</div>
</div>
</div>
</div>
</div>
There's a Bootstrap class for making images responsive: img-fluid.
Put this class in your img tag, and it should work without having to use other classes to make it look as you want.
Refer to: https://getbootstrap.com/docs/5.0/content/images/#responsive-images.
This link is for Bootstrap 5, but it works the same in Bootstrap 4.

How to make psd image in html

I am working on project where in final result, I need to have like this
As you can see in modal, there is background-image and 2 icons, my problem is I don't know how to make it,
I did a div with image background but for icons I have them in psb format and I don't know how to put them on the background in beautiful way .
I tried to screen part of icon and put it but it wasn't good
<section id="about">
<div class="container-fluid mt-0" style="background-image: url(background.png);background-size:cover;height:550px">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading mt-5">Nos activités</h2>
</div>
</div>
<div class="row text-center" >
<div class="col-md-6 image" >
<img src="icon1.png">
</div>
<div class="col-md-6" style="padding-top: 100px">
<img src="icon2.png">
</div>
</div>
<!--
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading ">Nos dernières réalisataions</h2>
</div>
</div>
</div>-->
</section>
This is the structure I'm doing - just replace the images and add the font type
.activities {
background-image: url('http://inspirationhut.net/wp-content/uploads/2013/05/61.png');
background-position: center;
background-size: cover;
width: 100%;
min-height: 100vh;
}
.activities .title {
margin: 0;
padding: 25px 0;
color: #5ABF28;
font-weight: bold;
}
.activities .row {
min-height: calc(100vh - 135px);
align-items: center;
}
.activities .activity {
display: block;
text-decoration: none;
margin: 10px auto;
}
.activities .activity p {
font-weight: bold;
color: #999;
}
.activities .activity button {
width: 30px;
height: 30px;
line-height: 0;
border-radius: 100%;
padding: 0;
margin: 0;
outline: 0;
background: none;
border: 2px solid #aaa;
font-size: 20px;
color: #999;
padding-bottom: 10px;
}
.activities .activity:hover p,
.activities .activity:hover button {
color: #5ABF28;
border-color: #5ABF28;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="activities text-center">
<div class="container">
<h2 class="title pt-5">Nos activités</h2>
<div class="row">
<div class="col-sm">
<a href="#" class="activity">
<img src="https://www.ikea.com/in/en/images/products/smycka-artificial-flower__0903311_PE596728_S5.JPG?f=s" alt="icon 1" height="120" />
<p class="text-uppercase mt-3">entretien de jardin</p>
<button>...</button>
</a>
</div>
<div class="col-sm">
<a href="#" class="activity">
<img src="https://www.ikea.com/us/en/images/products/smycka-artificial-flower-rose-white__0903190_PE596774_S5.JPG" alt="icon 1" height="120" />
<p class="text-uppercase mt-3">creation de jardin</p>
<button>...</button>
</a>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/js/bootstrap.min.js"></script>

change src image on hover using css

2 image appear in same time, up and down.
I want hover image display none.
Hover image is appear below primary image.
Primary image is hide when hover.
Seems like dont work. and really need help on this.
.card-img-top {
border-radius: 0;
height: 250px;
width: 100%;
top: 50%;
left: 50%;
transform: translate(0%, 0%);
object-fit: cover;
margin-bottom: 20px;
}
.card a img {
display: block;
}
.card a:hover img:first-child {
display: none;
}
<div class="card col-12 col-md-6 col-sm-12 col-lg-6 col-xl-4">
<a href="#">
<img class="card-img-top" src="images/True Blue Asia.jpg"/>
<img class="card-img-top" src="images/Asia Bagus.jpg"/>
<div class="card-img-overlay d-table-cell align-middle">
<p>true blue asia</p>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 col-md-3">
<div class="card-date">Oct 2019</div>
</div>
<div class="col-12 col-md-9">
<div class="card-title">Roots, Heritage, Authenticity</div>
<div class="card-content">Asia’s myriad cultures manifest in practices derived from traditional value systems.</div>
</div>
</div>
</div>
</a>
</div>
<div class="card">
<img src="/image_displayed_as_default" class="hover-hidden"/>
<img src="/image_displayed_when_hover" class="hover-only"/>
</div>
.card img {
opacity: 1;
transition: opacity 200ms;
}
.card:hover img.hover-hidden,
.card:not(:hover) img.hover-only {
opacity: 0;
}
You are looking for this
Pure CSS solution
#aks {
width:0px;
height:0px;
background:url('http://dummyimage.com/100x100/000/fff');
padding:50px;
}
#aks:hover {
background: url('http://dummyimage.com/100x100/eb00eb/fff');
}
<img id="aks" src="http://dummyimage.com/100x100/000/fff"/>
Your code solution
Issue i you are not hide second image initially
.card-img-top {
border-radius: 0;
height: 250px;
width: 100%;
top: 50%;
left: 50%;
transform: translate(0%, 0%);
object-fit: cover;
margin-bottom: 20px;
}
.card a img {
display: block;
}
.card a:hover img:first-child {
display: none;
}
.card a .card-img-below{
display: none;
}
.card a:hover .card-img-below {
display: block;
}
a{
display:block;
}
<div class="card col-12 col-md-6 col-sm-12 col-lg-6 col-xl-4">
<a href="#">
<img class="card-img-above" src="https://cdn4.iconfinder.com/data/icons/imoticons/105/imoticon_15-128.png"/>
<img class="card-img-below" src="https://cdn4.iconfinder.com/data/icons/imoticons/105/imoticon_12-128.png"/>
<div class="card-img-overlay d-table-cell align-middle">
<p>true blue asia</p>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 col-md-3">
<div class="card-date">Oct 2019</div>
</div>
<div class="col-12 col-md-9">
<div class="card-title">Roots, Heritage, Authenticity</div>
<div class="card-content">Asia’s myriad cultures manifest in practices derived from traditional value systems.</div>
</div>
</div>
</div>
</a>
</div>
Change the image url