The answer to your IT questions
 

Advanced search  • Search tips
My QUESTIONS & ANSWERS
 Question:

How to center div vertically

User Asked by: milen
Published on: 09:28/01.04.2008
Status: OPEN
How to center a div vertically in another div?
 Answers: 2
Sort by: /\ date | rating
Image Answer by: alexmaughan
Posted on: 15:51/02.01.2008
Rating: 1.8 from possible 5 with 5 votes
Vote:

Image Answer by: alexander
Posted on: 09:28/01.04.2008
Rating: 1.5 from possible 5 with 4 votes
This is the best way:



This is the best way:

<style type="text/css">
	.v-outer {
		display: table;
		#position: relative;
		overflow: hidden;
		height: 100px;
		background: black;
		color: white;
		width: 100%;
	}

	.v-middle {
		display: table-cell;
		#position: absolute;
		#top: 50%;
		vertical-align: middle;
	}

	.v-inner {
		#position: relative;
		#top: -50%;
	}
</style>
  <div class="border v-outer">
	<div class="v-middle">
		<div class="v-inner">
			...content...
		</div>
	</div>
    </div>
Vote:

Please vote! Your opinion matters!
If you haven't found what you've looking for, post a question
  
| Home | Hall of fame | Register | Log in | Terms of service | Help | Contacts |