vertical-alignment

How to vertically center a div for all browsers?

孤街醉人 提交于 2019-11-25 21:35:43
问题 I want to center a div vertically with CSS. I don\'t want tables or JavaScript, but only pure CSS. I found some solutions, but all of them are missing Internet Explorer 6 support. <body> <div>Div to be aligned vertically</div> </body> How can I center a div vertically in all major browsers, including Internet Explorer 6? 回答1: Below is the best all-around solution I could build to vertically and horizontally center a fixed-width, flexible height content box. It was tested and working for

How to Vertical align elements in a div?

大憨熊 提交于 2019-11-25 21:33:46
问题 I have a div with two images and an h1 . All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the CSS needed for this to work on all common browsers? <div id=\"header\"> <img src=\"..\" ></img> <h1>testing...</h1> <img src=\"...\"></img> </div> 回答1: Wow, this problem is popular. It's based on a misunderstanding in the vertical-align property. This excellent article explains it: Understanding