Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why text-align:center won't work for text input in Konqueror

Status
Not open for further replies.

leehinkleman

Programmer
Feb 14, 2002
83
NZ
I'm not really worried about Konqueror, but would like for a form input to center its text value in Safari, which may behave like Konqueror.

The form input is:
<input name="cgd" class="mo" type="text" size=74 value="Mouse Over River names for series details"><br>

and the style for class "mo" is

input.mo{
background:#ffffff;
color:black;
text-align:center;
font-family:verdana;
font-size:10pt;
font-weight:bold;
border:none
}

It works fine in Firefox 0.9 and IE6, but I don't know about Safari.

Thanks for your advice.
 
Odd - this centres the text perfectly for me in Safari (v2.0.3):

Code:
<html>
<body>
	<form>
		<input type="text" style="width:200px; text-align:center;" value="some" />
	</form>
</body>
</html>

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks for your answers, Vragabond and Dan.
I changed the form input to a <div id="e0">, and then used

document.getElementById("e0").innerHTML=mhf;

in a javascript function, using one argument of 'i' to reference values of a new Array mhf.

Using text-align:center; as one line in the style for #e0 now centers the text in the div in Firefox 0.9, IE6, and Konqueror, so I think it may work now in Safari.

I read that I should be using the standards-compliant method of 'createElement', 'setAttribute', 'appendChild', and 'createTextMode', instead of the simpler 'innerHTML', but may do that later, if I feel compelled to comply with standards.

I'm typing this from Windows, and will have to boot back into FreeBSD to see what version of Konqueror is in there.
Thanks again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top