Moving an image to the right side of a paragraph - html

Good day folks,
I am struggling with this for a couple of hours now and could really use some good help!
On my website I am trying to move an image to the right side of a paragraph of text.
My code snippet:
.innercontent {
display: inline-block;
position: relative;
width: 90%;
padding: 3% 5%;
}
.snap {
display: inline-block;
}
div.expitem {
margin: 100px 25px;
min-height: 300;
padding: 15px;
}
.text {
width: 50%;
}
<div class="innercontent">
<div class="expitem">
<h1>'Projectnaam 1'</h1>
<p class="text" >
'Projectomschrijving'
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
<div class="expitem">
<h1>'Projectnaam 2'</h1>
<p class="text" >
'Projectomschrijving'
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
</div>
For compatibility reasons I do not want to use float, but if there is no other way, I guess I should have to deal with that. Thank you in advance for trying to answer my question!!

You should try using a grid system like Bootstrap for the layout, but for your code:
Use display: inline-block on the paragraph since you want to allow
some space for the next item to come up on its line.
vertical-align: top to align the paragraph with the images as it
leaves some gap above it.
In order to align on smaller screens, you need to reduce the width of the paragraph using media queries.
Notice that while reducing the screen size further, the images align to the bottom. This is the use case for responsive images to get in. Wrap the image inside a % width div and give max-width: 100%, height: auto for the image. As you can see, you will not face any above difficulties if you use any grid system.
JSfiddle Demo
.innercontent {
display: inline-block;
position: relative;
width: 90%;
padding: 3% 5%;
}
.snap {
display: inline-block;
}
div.expitem {
margin: 100px 25px;
min-height: 300;
padding: 15px;
}
.text {
display: inline-block;
vertical-align: top;
width: 50%;
}
#media (max-width: 768px) {
.text {
width: 33%;
}
}
<div class="innercontent">
<div class="expitem">
<h1>'Projectnaam 1'</h1>
<p class="text">
'Projectomschrijving' Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
<div class="expitem">
<h1>'Projectnaam 2'</h1>
<p class="text">
'Projectomschrijving' Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
</div>

I changed the .text class by adding display: inline-block to it and that seems to push the image to right of the text on a full screen view for me (testing with Safari). Please check if that works like the way you want.
.innercontent {
display: inline-block;
position: relative;
width: 90%;
padding: 3% 5%;
}
.snap {
display: inline-block;
}
div.expitem {
margin: 100px 25px;
min-height: 300;
padding: 15px;
}
.text {
width: 50%;
display: inline-block;
}
<div class="innercontent">
<div class="expitem">
<h1>'Projectnaam 1'</h1>
<p class="text" >
'Projectomschrijving'
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
<div class="expitem">
<h1>'Projectnaam 2'</h1>
<p class="text" >
'Projectomschrijving'
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
</div>

you can solve the problem using bootstrap also.
.innercontent {
display: inline-block;
position: relative;
width: 90%;
padding: 3% 5%;
}
.snap {
display: inline-block;
}
div.expitem {
margin: 100px 25px;
min-height: 300;
padding: 15px;
}
.text {
width: 50%;
}
html code with bootstrap
<div class="innercontent">
<div class="row">
<div class="expitem">
<h1>'Projectnaam 1'</h1>
<div class="col-md-6">
<p class="text" >
'Projectomschrijving'
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
</div>
<div class="col-md-6">
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
</div>
<div class="expitem">
<h1>'Projectnaam 2'</h1>
<div class="col-md-6">
<p class="text" >
'Projectomschrijving'
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi assumenda unde culpa, ratione exercitationem minus vel quidem eum blanditiis, nobis sint corrupti, neque, rem! Quod aliquid voluptates at consequatur, praesentium.
</p>
</div>
<div class="col-md-6">
<a href="#" target="_blank">
<img alt="screenshot" src="http://www.webactiv.ro/poze/portofoliu_c/vest_grup_install_2014.jpg" width="320px" height="270px" class="snap" />
</a>
</div>
</div>
</div>
</div>

Related

I add the order element in the css, but the positions do not change

<section id="home">
<div class="container">
<div class="row align-items-center container-items">
<div class="col-md-6">
<div class="info">
<h1>Lorem ipsum dolor sit amet <u style="color: rgb(165, 177, 231);">consectetur.</u> </h1>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Fuga, pariatur corporis! Quaerat officiis sit rerum exercitationem
facilis quas ex veritatis quod dolores delectus reiciendis autem dignissimos doloremque consequuntur, ad eaque possimus corrupti.
Fugiat, non unde labore, cupiditate nobis quis maxime error, omnis rerum tenetur officiis ea doloremque qui nihil officia?</p>
</div>
<ul>
<li>
<img src="./image/freshfood.png" alt="">
<span><u>Fresh Foods</u> </span>
</li>
<li>
<img src="./image/restaurant.png" alt="">
<span> <u>Master Chefs</u> </span>
</li>
</ul>
</div>
<div class="col-md-6 food-img">
<div>
<img src="image/home.png" alt="">
</div>
</div>
</div>
</div>
</section>
I want the home.png image and h1,p elements in the html codes to be replaced under 575.98 px. When I bring the device to these dimensions, h1,p is on the top and home.png is on the bottom. For this reason;
#home .container-items {
display: flex;
}
#home .info{
max-width: 100%;
height: 15rem;
order: 1 ;
}
#home .food-img{
order: 2;
}
I wrote these codes. Could you please explain this to me; For the order element to work, don't I need to assign the order element in the css to the classes or ids I gave to these divs? Like the food-img and info classes in this code.
As Paulie_D points out, this only works on the direct children (identified by the class flex-item-1 and flex-item-2 in the code below). You can then specify the order for the child elements:
#home .container-items {
display: flex;
}
#home .info {
max-width: 100%;
height: 15rem;
}
#media only screen and (max-width: 575.98px) {
.container-items {
flex-direction: column;
}
.flex-item-1 {
order: 2;
}
.flex-item-2 {
order: 1;
}
}
<section id="home">
<div class="container">
<div class="row align-items-center container-items">
<div class="col-md-6 flex-item-1">
<div class="info">
<h1>
Lorem ipsum dolor sit amet
<u style="color: rgb(165, 177, 231)">consectetur.</u>
</h1>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Fuga,
pariatur corporis! Quaerat officiis sit rerum exercitationem
facilis quas ex veritatis quod dolores delectus reiciendis autem
dignissimos doloremque consequuntur, ad eaque possimus corrupti.
Fugiat, non unde labore, cupiditate nobis quis maxime error,
omnis rerum tenetur officiis ea doloremque qui nihil officia?
</p>
</div>
<ul>
<li>
<img src="https://picsum.photos/60" alt="" />
<span><u>Fresh Foods</u> </span>
</li>
<li>
<img src="https://picsum.photos/60" alt="" />
<span> <u>Master Chefs</u> </span>
</li>
</ul>
</div>
<div class="col-md-6 food-img flex-item-2">
<div>
<img src="https://picsum.photos/300/200" alt="" />
</div>
</div>
</div>
</div>
</section>
In this case, you could just use flex-direction: column-reverse; though:
#home .container-items {
display: flex;
}
#home .info {
max-width: 100%;
height: 15rem;
}
#media only screen and (max-width: 575.98px) {
.container-items {
flex-direction: column-reverse;
}
}
<section id="home">
<div class="container">
<div class="row align-items-center container-items">
<div class="col-md-6 flex-item-1">
<div class="info">
<h1>
Lorem ipsum dolor sit amet
<u style="color: rgb(165, 177, 231)">consectetur.</u>
</h1>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Fuga,
pariatur corporis! Quaerat officiis sit rerum exercitationem
facilis quas ex veritatis quod dolores delectus reiciendis autem
dignissimos doloremque consequuntur, ad eaque possimus corrupti.
Fugiat, non unde labore, cupiditate nobis quis maxime error,
omnis rerum tenetur officiis ea doloremque qui nihil officia?
</p>
</div>
<ul>
<li>
<img src="https://picsum.photos/60" alt="" />
<span><u>Fresh Foods</u> </span>
</li>
<li>
<img src="https://picsum.photos/60" alt="" />
<span> <u>Master Chefs</u> </span>
</li>
</ul>
</div>
<div class="col-md-6 food-img flex-item-2">
<div>
<img src="https://picsum.photos/300/200" alt="" />
</div>
</div>
</div>
</div>
</section>

How do i fit the image in the border?

How do I fit the whole image with borders as there is some space below it. AnyHelp would be appreciated, thanks . I have attached my code below, please refer it .
.Details {
margin-top: 100px;
}
.flexitems {
display: flex;
margin: 10px 100px 30px 100px;
width: 70%;
margin-left: 210px;
}
.sectionimg {
/*Flex-grow flex-shrink flex-basis*/
flex: 1 1 50%;
margin-right: 20px;
border: 4px solid rgb(0, 0, 0);
border-radius: 10px;
}
.flexinvert {
flex-direction: row-reverse;
}
.sectionimg img {
max-width: 100%;
}
.sectionhead {
font-size: 30px;
}
<section class="Details">
<div class="flexitems">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="Jeans.jpg" alt="">
</div>
</div>
<div class="flexitems flexinvert">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="mainpic.png" alt="">
</div>
</div>
<div class="flexitems">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="shirt.jpg" alt="">
</div>
</div>
</section>
You can try to object fit image and fullwidth its' height.
.sectionimg img {
max-width: 100%;
object-fit: cover;
height: 100%
}
All you need to do is specify height: 100%; to .sectionimg img so the image takes the full width and height of the parent.
.Details {
margin-top: 100px;
}
.flexitems {
display: flex;
margin: 10px 100px 30px 100px;
width: 70%;
margin-left: 210px;
}
.sectionimg {
/*Flex-grow flex-shrink flex-basis*/
flex: 1 1 50%;
margin-right: 20px;
border: 4px solid rgb(0, 0, 0);
border-radius: 10px;
}
.flexinvert {
flex-direction: row-reverse;
}
.sectionimg img {
max-width: 100%;
height: 100%;
}
.sectionhead {
font-size: 30px;
}
<section class="Details">
<div class="flexitems">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="https://dummyimage.com/600x400/000/fff" alt="">
</div>
</div>
<div class="flexitems flexinvert">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="https://dummyimage.com/600x400/000/fff" alt="">
</div>
</div>
<div class="flexitems">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="https://dummyimage.com/600x400/000/fff" alt="">
</div>
</div>
</section>

How to resize a big image with css?

I want to make the image almost half the height it is now but it should cover the whole image not the zoomed part only. How do i do it?
HTML code
<section class="Details">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="Jeans.jpg" alt="">
</div>
</section>
CSS
.Details {
display: flex;
}
.sectionimg {
width: 50%;
height: 10%;
}
See the modified example below. I'd suggest you do a research about how flex layout works and how image properties work in them.
.Details {
display: flex;
}
.sectionimg {
flex: 1 0 50%;
}
.sectionimg img {
max-width: 100%;
}
<section class="Details">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="https://i.stack.imgur.com/Hc97v.png" alt="">
</div>
</section>

Bootstrap section stacking with above section on mobile screen size

I am having a problem. Everything seemed perfect when I finished section-3, but when I started coding section-4, it started stacking on section-3's content.
Code
HTML
<!-- Start Of SECTİON TREE !-->
<section class="section-3" id="sec3">
<div class="tribg">
<img src="Parts/triangles.png" alt="" class="img-fluid">
</div>
<div class="container-fluid">
<div class="row">
<div class="card-deck">
<div class="col-md-4">
<div class="card mycards">
<img src="Parts/shield.png" alt="" class="img-fluid" width="50px">
<div class="card-body">
<h3 class="card-title">DENEME</h3>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam sint expedita alias, dolorem sapiente culpa distinctio libero saepe. Recusandae numquam aut aliquam, ullam voluptatum placeat quis omnis perspiciatis, distinctio quae eaque nemo consequatur ratione mollitia beatae alias molestiae quod optio ipsa. Totam assumenda, aperiam quae!</p>
<div class="btn btn-primary">DENEME</div>
</div>
</div>
<div class="col-md-4">
<div class="card mycards">
<img src="Parts/shield.png" alt="" class="img-fluid" width="50px">
<div class="card-body">
<h3 class="card-title">DENEME</h3>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam sint expedita alias, dolorem sapiente culpa distinctio libero saepe. Recusandae numquam aut aliquam, ullam voluptatum placeat quis omnis perspiciatis, distinctio quae eaque nemo consequatur ratione mollitia beatae alias molestiae quod optio ipsa. Totam assumenda, aperiam quae!</p>
<div class="btn btn-primary">DENEME</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mycards">
<img src="Parts/shield.png" alt="" class="img-fluid" width="50px">
<div class="card-body">
<h3 class="card-title">DENEME</h3>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam sint expedita alias, dolorem sapiente culpa distinctio libero saepe. Recusandae numquam aut aliquam, ullam voluptatum placeat quis omnis perspiciatis, distinctio quae eaque nemo consequatur ratione mollitia beatae alias molestiae quod optio ipsa. Totam assumenda, aperiam quae!</p>
<div class="btn btn-primary">DENEME</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End Of SECTİON TREE !-->
<!-- Start Of SECTİON FOUR !-->
<section class="section-4">
<div class="holder"><img src="Parts/shape9.png" alt="" class="img-fluid"></div>
</section>
<!-- End Of SECTİON FOUR !-->
CSS
/* SECTİON TREE */
.section-3 {
position: relative;
height: 100vh;
}
.tribg {
position: absolute;
top: 30%;
left: 20%;
z-index: 0;
}
.mycards {
padding: 60px 100px;
margin-top: 8rem;
border-radius: 63px;
box-shadow: 6px 7px 100px rgba(0, 0, 0, 0.16);
transition: .3s;
}
.mycards p {
margin-bottom: 6rem;
}
.cardimg {
margin-bottom: 30px;
}
.mycards:hover {
transform: translateY(-30px);
}
.gotopanel {
font-size: 20px;
}
/* End Of SECTİON TREE */
/* SECTİON FOUR */
.section-4 {
height: 100vh;
}
The problem is in your css, remove or change height property here:
.section-3 {
position: relative;
height: 100vh;
}
.section-4 {
height: 100vh;
}

Align two buttons that are in two different DIVs

So I tried to play a bit with my code and was looking on many forums to see if the answer was already given. I didn't find anything yet. I wanted to know how to align the buttons divs to each other, like this :
At this time, my code is this :
.directeur {
width: 50%;
float: left;
}
.directeur p {
width: 80%;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
margin-top: 10px;
}
.directeur a>img {
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
display: block;
}
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur maxime impedit amet labore facere. Quod quos consectetur nulla eaque soluta tenetur omnis quo sunt, modi optio iste consequuntur atque error.</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus rem delectus enim dolorem, error nulla earum maxime aliquid ipsam, recusandae molestiae ducimus iusto, dolore omnis. Saepe temporibus autem, provident dolor!</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
Can someone help me ? I created other Divs, tried Vertical-Align and Inline-Block. I want the Green Button Rectangle to align like this in my code. At the moment, they are not align because of the height of the text box.
Have you tried this.
.custom_element{
position: absolute;
left:0;
right:0;
text-align: center;
}
Replace custom_element with your required element.
This is a job for Flexbox!
Wrap you whold code in a flexbox container, which will ensure all your .directeurs have the same height
Use flexbox for your .directeur, with flex-direction: column to arrange sub-elements vertically.
Set margin-top: auto on your last element (.directeur a) to ensure it will always be a the very bottom of its parent.
.directeurs {
display: flex;
}
.directeur{
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
}
.directeur p {
width: 80%;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
margin-top: 10px;
}
.directeur a {
margin-top: auto;
}
.directeur a > img{
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
display: block;
}
<div class="directeurs">
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur maxime impedit amet labore facere. Quod quos consectetur nulla eaque soluta tenetur omnis quo sunt, modi optio iste consequuntur atque error.</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus rem delectus enim dolorem, error nulla earum maxime aliquid ipsam, recusandae molestiae ducimus iusto, dolore omnis. Saepe temporibus autem, provident dolor! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus rem delectus enim dolorem, error nulla earum maxime aliquid ipsam, recusandae molestiae ducimus iusto, dolore omnis. Saepe temporibus autem, provident dolor!</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
</div>
Set a min-height for the Lorem ipsum parts of this to make them the same:
.directeur{
width: 50%;
float: left;
}
.directeur p {
width: 80%;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
margin-top: 10px;
min-height: 225px;
}
.directeur a>img{
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
display: block;
}
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur maxime impedit amet labore facere. Quod quos consectetur nulla eaque soluta tenetur omnis quo sunt, modi optio iste consequuntur atque error.</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus rem delectus enim dolorem, error nulla earum maxime aliquid ipsam, recusandae molestiae ducimus iusto, dolore omnis. Saepe temporibus autem, provident dolor!</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
Or you can use some javascript to measure the tallest one then make the other one the same height on page load, something like Equalise.
You can use display:table-cell and position. I have taken the liberty of adding a wrapper around the two .directeurs. See it it works for you.
.directeur-wrapper{
display:table;
}
.directeur{
display:table-cell;
width:50%;
padding:20px 20px 80px;
position:relative;
}
.directeur img{max-width:100%;}
.directeur a{position:absolute; bottom:0;}
<div class="directeur-wrapper">
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur maxime impedit amet labore facere. Quod quos consectetur nulla eaque soluta tenetur omnis quo sunt, modi optio iste consequuntur atque error.</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
<div class="directeur">
<img src="http://via.placeholder.com/500x150" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus rem delectus enim dolorem, error nulla earum maxime aliquid ipsam, recusandae molestiae ducimus iusto, dolore omnis. Saepe temporibus autem, provident dolor!</p>
<img src="http://via.placeholder.com/300x70" alt="">
</div>
</div>