.no-image { background: url('/assets/images/no-image.jpg') no-repeat center center #FFF; background-size: contain; } .categories { float: left; width: 23%; } <div class="categories no-image" style=" background: url('http://pir.uborka25.ru/assets/img/sets/035nb-zhivi-yarko.jpg') no-repeat; background-size: contain; margin: 1%; "> <div class="categories-dark"> <span class="hint">C ΠΊΡΠ΅ΠΌΠΎΠΌ</span> <div class="link-category"> <a href="kapkeyki /s-kremom/" title="ΠΠ»Π°ΡΡΠΈΡΠ΅ΡΠΊΠΈΠ΅ ΠΊΠ°ΠΏΠΊΠ΅ΠΉΠΊΠΈ Ρ ΠΊΡΠ΅ΠΌΠΎΠΌ">ΠΡΠ±ΡΠ°ΡΡ </a> </div> </div> </div> It is necessary that the height of the block depends on the height of the image for a given width. On pure css, js, the implementation is already there (