Comrades tell me how to align the menu block in the center which is greater than the width of the container in which it lies ...? ) enter image description here

  • markup and styles where? don't you need a solution? - MaximLensky
  • thanks, already decided - Eugene
  • delete the question .. but decided not right - MaximLensky
  • how much is not true ?? - Eugen

2 answers 2

So, for any width.

.little{ width: 200px; padding: 50px 0; margin: 0 auto; background: red; } .big{ width: 500px; height: 100px; background: blue; margin-left: 50%; transform: translateX(-50%); } 
 <div class="little"> <div class="big"></div> <div> 

  • thanks, bro) with a minus margin this is not true - Eugene
  • @ Evgen where is the negative margin? - MaximLensky 2:21 pm

Understood the solution, set margin-left: -20px ;, maybe not 20px, this width is taken from half of the projecting part