Solved

How can I get this submit button centered?

Posted on 2013-12-23
4
226 Views
Last Modified: 2013-12-24
Check out my site at http://www.muscularchristianityonline.com/campus. I want to get the "submit" button at the top of the page centered relative to the fields to the left.

I've got my HTML below. You can find the stylesheet at http://www.muscularchristianityonline.com/stylesheet.css.

<table class="login">
		<tr>
		<td style="width:410px; height:23px; vertical-align:center;">
		<form action="student_validate_header.php" method="Post" style="display:inline; padding:0;"><input type="text" size="23" class="login" name="email" value="email">
		<input type="password" size="23" class="login" name="password" value="password">
		<input type="image" src="images/login.png" border="0" name="submit"></form></td>
		<td>
		<IMG SRC="images/spacer.gif" width="325" height="23">
		</td>
		<td background="images/spacer.gif" width="175" height="23" style="vertical-align:top;">
			<table style="padding:0px; border-spacing:0; border-collapse:collapse; background-color:#ffffff;"><form action="search.php" method="Post" style="display:inline; margin:0;">
			<tr>
			<td>
			<input type="text" name="search" size="23" value="" style='border:0px; height:18px'>
			</td>
			<td style="vertical-align:top;">
			<input type="image" src="images/search_icon.png" border="0" name="submit">
			</td>
			</tr>
			</table></form>
		</td>
		</tr>
		</table>

Open in new window

0
Comment
Question by:brucegust
4 Comments
 
LVL 8

Accepted Solution

by:
Adrian Crabtree earned 300 total points
ID: 39737096
If you add "vertical-align: middle;", that should fix your issue. 

CSS

input[name="submit"] { 
  vertical-align: middle;
}

Open in new window

0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 150 total points
ID: 39737138
In addition, the button is wrapped below the email input when viewing in chrome. When in the console, I added 10px to the td and it worked although not centered vertically.  You should either make the inputs a little smaller or the td a little wider.
0
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 50 total points
ID: 39737430
For me, Chrome displayed it in line with the login fields, but Firefox displayed it below.

Anyway, vertical-align: middle seems to align it on the bottom of the fields (see picture). You need a margin-bottom of 2-3px to make it look like it's center vertically.

Submit button in ChromeSubmit button in Firefox
0
 

Author Comment

by:brucegust
ID: 39738183
Thanks guys!

I got it done, thanks to your expertise and counsel.

I've got another question at http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_28325170.html and would welcome your suggestions.

Thanks and Merry Christmas!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

"I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now