I am struggling to center my container div vertically, similar to how it is horizontally aligning with margin: auto;
. Despite searching online for solutions, I have not been successful in finding a method that works for me. It is surprising to me that in the year 2011, there is no straightforward CSS command for achieving this task, especially when horizontal centering is as easy as using margin: auto;
. Is there a universal approach to vertical centering that I am missing?
#container
{
margin: auto;
width: 960px;
height: 640px;
background-color: brown;
}