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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit button

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
IE
I have the follwing css code for a submit button i am using
how can i align it to the center. The following code does not work for me. Any suggestions ?

.btn1{
background-color: transparent;
border: 0;
padding: 0px;
color:#000066;
align:center;
}

<input type="submit" name="submit" value="Submit & Logout" class="btn1"/></br>
 
one way would be to place it in a <div> that has 100% width and text-align of center:

Code:
<div style="text-align: center;"><input type="submit" ... /></div>

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
or a better way:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]

<html>
<head>
<title>Untitled</title>
</head>

<body>

<form name="f">
<input style="margin: 0 auto; display: block;" type="submit" />
</form>


</body>
</html>

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
Text-align center doen't seem to work. The div method worked fine.

Tks everyone
 
[tt]text-align: center;[/tt] applied to the <input> element will centre-align the text on the button. [tt]margin: 0 auto; display: block;[/tt] will (or should) control the positioning of the button itself. Be aware, though, that IE is a bit flaky in its support for [tt]auto[/tt] margins, so the <div> method may be more reliable.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top