Topic: Vertically Centering a textbox in a DIV (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=27895" title="Pages that link to Topic: Vertically Centering a textbox in a DIV (Page 1 of 1)" rel="nofollow" >Topic: Vertically Centering a textbox in a DIV <span class="small">(Page 1 of 1)</span>\

 
Maskkkk
Paranoid (IV) Inmate

From: Indiana, PA
Insane since: Mar 2002

posted posted 05-06-2006 16:36

Is there any way to vertically center a textbox in a DIV?

(That works exactly the same in IE and Firefox)



- AIM: MASKKKK

01001101011000010111001101101011011010110110101101101011

BillyRayPreachersSon
Bipolar (III) Inmate

From: London
Insane since: Jul 2004

posted posted 05-13-2006 15:18

It sure is. How you go about doing it will depend on your exact requirements, however, as different methods have different pros and cons. Take this, for example:

code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<meta http-equiv="content-language" content="en">
	<title>Horizontal centering demo</title>

	<style type="text/css">
		div {
			height: 10em;
			line-height: 10em;
			background-color: #CC0000;
		}
	</style>
</head>

<body>
	<div>
		This will be centred horizontally
	</div>
</body>
</html>



It's fine until the text wraps onto two lines, but is very effecttive otherwise.

Dan

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 05-14-2006 04:35

I think he meant a text-box as in the form input box element.


Justice 4 Pat Richard

BillyRayPreachersSon
Bipolar (III) Inmate

From: London
Insane since: Jul 2004

posted posted 05-15-2006 08:18

Does this help?

http://www.jakpsatweb.cz/css/css-vertical-center-solution.html

Dan



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu