I am trying to get an even spacing between divs inside a div with a set width of max the containing elements and this div is in another div which contains the other two and is set to width 60%.
You can see the 4 divs which are in a bigger div that holds all the 4 divs. The bigger div has a width of 60%. I tried to make a % margin to the right but even at 1% one of the img gets in the next line and I don't want that.
I also tried margin:auto, align-items:center and some other stuff but nothing worked and most of them didn't do anything. Note that I don't want to use any responsive web design things like flexbox!
div order.
.container {
width: 60%;
/*This is the biggest one and contains everything from the side that has to be in the center*/
margin: auto;
}
.container1 {
margin: 15px 15px 15px 0px;
}
.angebotTop {
display: inline-block;
width: max-content;
}
.angebote {
width: 250px;
height: 300px;
float: left;
margin: 10px auto 10px 10px;
}
<h2>Unterkünfte rund um die Welt</h2>
<div class="container1">
<div class="angebotTop">
<div class="angebote">
<img src="Bilder/Airbnb/hotel-2.jpg" alt="">
<p id="angebot">GANZE WOHNUNG ⸱ KOPENHAGEN</p>
<p id="beschreibung">Sonniges Penthouse mit 5 Balkonen</p>
<p id="preis">206€ pro Nacht</p>
<p id="bewertung">★★★★★ 320</p>
</div>
<div class="angebote">
<img src="Bilder/Airbnb/hotel-3.jpg" alt="">
<p id="angebot">GANZES HAUS ⸱ FUJIEDA</p>
<p id="beschreibung">Yui Valley-Traditional <br> House</p>
<p id="preis">89€ pro Nacht</p>
<p id="bewertung">★★★★★ 220</p>
</div>