in Advanced 

Question preview

HomeQuestion preview:
Log in

How to center div vertically

How to center a div vertically in another div?
Do you know someone who could answer? Ask him for help
Answers: 2
Sort by: date rating
image alexmaughan
17:51/02.01.2008
1.8 from possible 5 with 5 votes
Vote:
image alexander
12:28/01.04.2008
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
Ask question
| Home | Hall of fame | Registration | Log in | Terms of service | Privacy policy | Help | Contacts | RSS |