Skip to content Skip to sidebar Skip to footer

How To Vertical And Horizontal Align A Div Inside Another Div?

How do I vertical and horizontal align a div inside another div? Basically, I'm trying to align
inside
.

Solution 1:

http://phrogz.net/css/vertical-align/index.html the article of all articles on this topic.

Solution 2:

Are you trying to horizontally align the middle2 div inside the middle div? You haven't specified a width for either, so both divs will have the same width and horizontal align effectively won't do anything here.

I think what you want is to horizontally align the middleContent div inside the middle2 div. Since middleContent is set at 90% width, the effect of the horizontal align should be noticeable. To do this, add the following to your CSS code:

#middle2 {
  text-align: center;
}

#middleContent {
  margin: auto;
}

That should do it. If it's still not working, please update your question with your latest code.

Post a Comment for "How To Vertical And Horizontal Align A Div Inside Another Div?"