View Single Post
Old 12-25-2012, 05:08 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello eetec,
A single line of text is easy to vertically centered with line-height, like this -
Code:
.topmenumiddle {
	width: 393px;
	line-height: 41px;
	float: left;
	position: relative;
	/*vertical-align: middle;*/
	color: #fff;
	background: url(../images/top_small_menu_middle.png) repeat-x 0 0;
}
vertical-align
line-height

It gets more complicated if you want to center a paragraph or div element. See some vertical center examples here.
My favorite is the last one which uses a float and a clear.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
eetec (12-26-2012)