Here is the layout of the diva where there is a previously mentioned problem.

#commonbackground { /* Общий большой div для бэкграунда*/ height: 1952px; width: 1170px; background-color: #f6f6f6; } #divcategorydescript { /* div для картинки с описанием категории*/ width: 878px; height: 324px; float: left; } .forsingleitem { float: left; } .divpic { /*Дивы для блока с "изображением товара"*/ background-color: #d1d3d4; width: 290px; height: 236px; font-family: 'Supermolot Light', Arial; font-size: 32px; line-height: 36px; margin-left: 2px; margin-top: 2px; color: #ececed; } .divgoodsname { /* Дивы с названием и ценой товара (белая полоса)*/ background-color: #ffffff; width: 290px; height: 88px; margin-left: 2px; } #picpromo { /*Див с большим изображением "заголовок промо - товара"*/ width: 586px; height: 650px; margin-top: 976px; margin-left: 585px; position: absolute; } 
 <div id="commonbackground"> <!--Общий большой див для бэкграунда--> <div id="divcategorydescript"> <!--Див для картинки с описанием категории--> <img id="categorydescriptpic" src="./pics/bikeincategory.jpg" alt="Pic"> <div id="categorydescript">ОПИСАНИЕ КАТЕГОРИИ <br><span id="shorttextaboutcategory">Краткий текст о категории</span> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div id="picpromo"> <!--Див для изображения с Промо-товаром--> <img id="promopicture" src="./pics/WakeboardPromoBackground.jpg" alt="Picture"> <div id="promoheader">ЗАГОЛОВОК <br>ПРОМО-ТОВАРА <br><span id="promodescription">Описание промо-товара</span> </div> <div id="promopricedigits">4 540<span id="promopricedigitsrub">руб.</span> </div> <a href="#"> <div id="takepeekcategory">Посмотреть +</div> </a> </div> </div> <!--Конец общего большого дива для бэкграунда--> 

  • css would still see - Vlad Vlad
  • one
    You can delete the comments :) - Vlad Vlad
  • I missed the total diva width of 1170px; - lihim
  • Formulate the problem itself. What you do not like in the positioning of your blocks. What do you want to get? - Gleb Kemarsky
  • one
    @ reckless advice: click on the link to edit (at the bottom of your post), scroll down a bit and under the block with the code there is a link "edit sample code", edit and adjust to the form that you have (so that we can see the problem itself), click the button " Insert into the message ", and save the edited post - Vlad Vlad

1 answer 1

Try instead of absolute positioning to use float:right; :

  1. Block with float:right; put first.
  2. To block the title to occupy the entire free width of the screen, assign it overflow: hidden; .
  3. In order for the product lines not to crumple when meeting with the promo block, you need to either choose the height of the promo block or set clear:left; through media queries. Media queries take longer to count and recalculate longer, if any size changes in the layout. It is better to choose the height of the promo block.

Option with the calculation of the height of the promo block

This is an example. Under your layout, count the dimensions yourself.

 /* чтобы браузер вычислял размеры блоков, включая border и padding внутрь width и height: https://webref.ru/layout/learn-html-css/box-model */ * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } #commonbackground { /* общий фон */ background-color: #f6f6f6; overflow: hidden; /* заставляем обернуть все плавающие блоки */ width: 100%; } #divcategorydescript { /* картинка с описанием категории */ background: green; height: 100px; overflow: hidden; } #picpromo { /* блок с промо-товаром */ background: orange; float: right; height: 426px; /* = 100px #divcategorydescript height + 2px .forsingleitem margin-top + 236px .divpic height + 88px .divgoodsname height */ width: 290px; } .forsingleitem { /* блок с одним из товаров */ float: left; margin-top: 2px; margin-right: 2px; } .divpic { /* блок изображением товара */ background: #d1d3d4; color: #ececed; font-family: 'Supermolot Light', Arial; font-size: 32px; height: 236px; line-height: 36px; width: 290px; } .divgoodsname { /* блок с названием и ценой товара (белая полоса) */ background: #fff; height: 88px; line-height: 36px; } #divcategorydescript, #picpromo, .divpic, .divgoodsname { /* отступ внутри блока для красоты */ padding: 4px 12px; } 
 <div id="commonbackground"> <!--Общий большой див для бэкграунда--> <div id="picpromo"> <!--Див для изображения с Промо-товаром--> <img id="promopicture" src="./pics/WakeboardPromoBackground.jpg" alt="Picture"> <div id="promoheader">ЗАГОЛОВОК <br>ПРОМО-ТОВАРА <br><span id="promodescription">Описание промо-товара</span> </div> <div id="promopricedigits">4 540<span id="promopricedigitsrub">руб.</span> </div> <a href="#"> <div id="takepeekcategory">Посмотреть +</div> </a> </div> <div id="divcategorydescript"> <!--Див для картинки с описанием категории--> <img id="categorydescriptpic" src="./pics/bikeincategory.jpg" alt="Pic"> <div id="categorydescript">ОПИСАНИЕ КАТЕГОРИИ <br><span id="shorttextaboutcategory">Краткий текст о категории</span> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> <div class="forsingleitem"> <!--Див для одного товара с описанием и ценой--> <div class="divpic"> <div class="goodspic">Изображение <br>товара</div> <div class="cornerdiv"></div> </div> <div class="divgoodsname"> <div class="goodsnamestr">Название товара</div> <div class="pricedigits">4 540<span class="pricedigitsrub">руб.</span> </div> </div> </div> </div> <!--Конец общего большого дива для бэкграунда--> 

  • Comments are not intended for extended discussion; conversation moved to chat . - Nofate