I would like to adjust my images to the size of the content. In some columns the image is too big in comparison to the content. In the following jsfiddle is the example
After several trial and error I can solve the problem by just giving the div
containing the image a background-image
but I want to avoid this solution as I would like to have an actual image with an alt title for SEO reasons. Here is my desired result (but with an actual image, not a background-image
.col-4 {width: 33.33%;}
.col-8 {width: 66.66%;}
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
*::before, *::after {
box-sizing: border-box;
}
[class*="col-"]{
float: left;
}
.row {
display: flex;
flex-flow: wrap;
}
.row::after {
content: "";
clear: both;
display: block;
}
#services .row{
background-color: #1AC4F8;
margin-bottom: 30px;
}
#services .col-4{
background-image:url("http://truck-art-project.com/wp-content/uploads/2016/09/CARRUSEL-TRUCK-SIXE_EN.jpg");
background-size:cover;
}
#services .col-8{
padding: 20px 20px;
}
#services .col-8 > *{
color: white;
margin: 0 0 20px 0;
}
<section id="services">
<div class="row">
<div class="col-8">
<h3>Przeprowadzki krajowe i międzynarodowe</h3>
<p>Nasza firma transportowa oferuje usługi przeprowadzki na terenie całego kraju jak również poza granicami na terenie całej Europy. Prosimy o kontakt w celu otrzymania indywidualnej wyceny.</p>
</div>
<div class="col-4"></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8">
<h3>Taksówka bagażowa</h3>
</div>
</div>
</section>
2
Answers
You could use bootstrap grid system, make it really simple (for sure you could make your own, define the width, but also you need few media query to define width in different screen size)
Include Bootstrap CSS to your project, or take some source code from it and make your own.
I hope this is what you are looking for.
The size of the image could be changed by yourself.
You can use an image with a src and alt, and can add some information next to it.