Adamhull1 Posted April 28, 2014 Share Posted April 28, 2014 (edited) Hello I am struggling to align my php form using my CSS and need help the form is currently floating on the right and I need it in the centre any help would be great full CSS body { margin: 0; padding: 0; font-size: 12px; font-family: "Open Sans"; background: url(http://w3theory.com/clients/BO/images/login/background_repeat.jpg) repeat; }.wrap { width: 100%;}.row { margin: 0 auto; width: 832px;}.small_row { margin: 0 auto; width: 750px;}#outer { min-height: 600px; background: url(http://w3theory.com/clients/BO/images/login/background_x_repeat.png) repeat-x; }/* Top Bar Styles */#top_bar { height: 65px; background: url(http://w3theory.com/clients/BO/images/login/top_bar.png) repeat-x; }#top_bar .login_input { float: left; margin: 6px 15px 0 0; width: 182px; height: 42px; background: url(http://w3theory.com/clients/BO/images/login/login_input.png) no-repeat; }#top_bar .login_input .none { margin: 7px 0 0 7px; width: 170px; height: 22px; color: #d9d4b5; line-height: 22px; background: none; border: none; outline: none; font-size: 11px;}#top_bar .log_in { float: left; margin: 6px 15px 0 0; cursor: pointer; outline: none; width: 47px; height: 42px; border: none; background: url(http://w3theory.com/clients/BO/images/login/login_btn.png) no-repeat; }#top_bar .log_in:hover { opacity: .65;}#top_bar .text { float: left; line-height: 52px; color: #d9d4b5;}#top_bar .text a { color: #d9d4b5; text-decoration: none; font-size: 11px;}#top_bar .text a:hover { color: #fff;}/* Header Styles */#header {}#header #logo { float: left; margin: 25px 0 0 0; width: 348px; height: 98px; background: url(http://w3theory.com/clients/BO/images/login/logo.png) no-repeat; }#header #menu { float: left; margin: 20px 0 0 30px; width: 189px;}#header #menu a { display: block; width: 189px; height: 32px; color: #d9d4b5; line-height: 32px; text-align: center; text-shadow: 1px 0 1px #000; font-weight: bold; text-decoration: none; background: url(http://w3theory.com/clients/BO/images/login/menu_btn.png) no-repeat; }#header #menu a:hover { opacity: .85;}#header #news_box { position: absolute; margin: 30px 0 0 585px; width: 232px; height: 283px; background: url(http://w3theory.com/clients/BO/images/login/news_box.png) no-repeat; }#header #news_box p { padding: 25px 35px; color: #dbd6b8; font-size: 12px; -webkit-transform: rotate(2deg); -moz-transform: rotate(2deg); -ms-transform: rotate(2deg); -o-transform: rotate(2deg); transform: rotate(2deg);}#header #news_box p span.title { font-weight: bold; font-size: 20px; line-height: 34px; display: block;}#header #news_box p span.date { color: #c17830; font-size: 12px; line-height: 40px; display: block;}/* Content Styles */#content_box { }#content_box .top { height: 55px; background: url(http://w3theory.com/clients/BO/images/login/content_box_bg_01.png) no-repeat; }#content_box .middle { min-height: 250px; background: url(http://w3theory.com/clients/BO/images/login/content_box_bg_02.png) repeat-y; }#content_box .middle .pad { padding: 15px 70px 10px 70px;}#content_box .middle h2 { margin: 0; text-indent: 15px; text-transform: uppercase; font-size: 35px; line-height: 30px; color: #29271d; border-left: 15px solid #29271d;}#content_box .middle p.first_paragraph { width: 550px; line-height: 22px; color: #29271d; font-size: 11px;}#content_box .middle p.second_paragraph { line-height: 22px; color: #574221; font-size: 11px;}#content_box .middle a.enlist { margin: 10px 0; display: block; text-indent: 25px; font-size: 30px; width: 677px; height: 105px; line-height: 105px; text-transform: uppercase; font-weight: bold; text-decoration: none; color: #88724f; background: url(http://w3theory.com/clients/BO/images/login/enlist_now_btn.png) no-repeat; }#content_box .middle a.enlist:hover { color: #42341f;}#content_box .bottom { height: 61px; background: url(http://w3theory.com/clients/BO/images/login/content_box_bg_04.png) no-repeat; }/* Footer Styles */#footer { padding: 25px 0; text-align: center; color: #231d13; font-size: 11px; line-height: 22px;}#footer span { font-weight: bold; font-size: 30px; line-height: 34px;}#footer a { color: #231d13; text-decoration: none;}#footer a:hover { color: #dfdabf; text-decoration: underline;}.spacer { clear: both;}[\code]Register page[code=auto:0]<?phpsession_start();include 'dbcon.php';include 'classes.php';$time = date(F." ".d.", ".Y." ".g.":".i.":".sa,time());function badmailhost($str) { $badhosts = file("mailhosts.txt"); foreach($badhosts as $mailhosts) $mailhosts = str_replace(array("\r", "\n", "()", " "), "", trim($mailhosts)); return true;}function mres($str) { return mysql_real_escape_string($str);}$classes = array( 'Mastermind', 'Assassin', 'Bodyguard', 'Smuggler', 'Thief');if(isset($_POST['submit'])) { $username = trim(mres($_POST['newname'])); $signuptime = time(); $password = hash("md5", trim(mres($_POST['newpass']))); $password2 = hash("md5", trim(mres($_POST['newpassagain']))); $email = isset($_POST['email']) && is_string($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ? $_POST['email'] : null; $checkuser = mysql_query("SELECT `id` FROM `grpgusers` WHERE `username` = '$username'"); if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); $message .= "<font color='red'><b>The verification code you entered is invalid.</br>";} if(mysql_num_rows($checkuser)) $message .= "<div>I'm sorry but the username you chose has already been taken. Please pick another one.</div>"; if(strlen($username) < 4 or strlen($username) > 20) $message .= "<div>The username you chose has " . strlen($username) . " characters. You need to have between 4 and 20 characters.</div>"; if(strlen($password) < 4 or strlen($username) > 20) $message .= "<div>The password you chose has " . strlen($password) . " characters. You need to have between 4 and 20 characters.</div>"; if($password != $password2) $message .= "<div>Your passwords don't match. Please try again.</div>"; if(empty($email)) $message .= "<div>The e-mail address you entered was invalid.</div>"; $_POST['class'] = isset($_POST['class']) && ctype_alpha($_POST['class']) && in_array($_POST['class'], $classes) ? $_POST['class'] : null; if(empty($_POST['class'])) $message .= "<div>The class you chose was not valid</div>"; if(!isset($message)) { $result = mysql_query("INSERT INTO `grpgusers` (`ip`, `username`, `password`, `email`, `signuptime`, `lastactive`, `class`) VALUES ('" . mres($_SERVER['REMOTE_ADDR']) . "', '$username','$password', '$email', $signuptime, $signuptime, '" . $_POST['class'] . "')"); $_POST['referer'] = isset($_POST['referer']) && ctype_digit($_POST['referer']) ? abs(@intval($_POST['referer'])) : null; if(!empty($_POST['referer'])) mysql_query("INSERT INTO `referrals` (`when`, `referrer`, `referred`) VALUES ($signuptime, " . $_POST['referer'] . ", '" . $username . "')"); // SMF Integration // The following ___VALUE___'s, enter the relevant details for SMF database//$link = mysql_connect("localhost", "dylan_game", "demo123");mysql_select_db("dylan_game", $link) or die(mysql_error());$passwd = ($password) . $_POST['password'];mysql_query("INSERT INTO dylan_game.`smf_members` (`member_name`,`date_registered`,`real_name`,`email_address`,`passwd`) VALUES ('{$username}',unix_timestamp(),'{$username}','{$_POST['email']}', '{$passwd}')");mysql_query("UPDATE `smf_settings` SET `value`='{$username}' WHERE `variable`='latestRealName'");mysql_query("UPDATE `smf_settings` SET `value`=`value`+1 WHERE `variable`='totalMembers'");mysql_close($link);// SMF Integration // echo Message('<font color="red"><b>Thank you for signing up with Battle Ops, We have sent an email to verify your account. Redirecting to login page in 5 seconds.<!-- Game-Advertising-Online.com Action Tracker --><img src="http://www.game-advertising-online.com:81/ats.php?aid=3715" width="1" height="1"> <meta http-equiv="refresh" content="5;url=index.php">'); if ($_POST['referer'] != ""){ $result= mysql_query("INSERT INTO `referrals` (`when`, `referrer`, `referred`)". "VALUES ('$signuptime', '".$_POST['referer']."', '".$username."')"); } // Let's mail the user! $subject = "Welcome to Battle Ops $username"; $message = "Dear $username, your Battle Ops details! Upon logging in for the first time, your user account will be activated, you can then login with the following details: These Details will be THE SAME for our forums as well. Username: $username Password: $password Thanks! Battle Ops staff. Enjoy your game. This is an automated response, please do not reply!"; mail($_POST["email"], $subject, $message, "From: Battle Ops Account<noreply@wisecrime.com>"); die(); }}if(isset($message)) { echo Message($message);}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Battle Ops - The Game</title><link type="text/css" rel="stylesheet" href="http://www.w3theory.com/clients/BO/login.css" /><body><div id="outer" > <div id="header" class="small_row"> <div id="logo"></div> <div id="menu"> <a href="home.php">HOMEPAGE</a> <a href="register.php">REGISTER</a> <a href="contact.php">CONTACT US</a> <a href="http://www.votelistedgames.com/index.php?page=in&id=11">Vote For Us!</a> </div> <div id="news_box"><center> <table float="left" width='100%' border='0' align='center' cellpadding='0' cellspacing='0'><form name='register' method='post' action='register.php'></div> <input type='text' name='newname' placeholder='username' /><td><font size='2' face='verdana'><tr> <input type='password' name='newpass' placeholder='password'/> </font><font size='2' face='verdana'><font size='2' face='verdana'><input type='password' name='newpassagain' placeholder='confirm password' /> </font> <font size='2' face='verdana'><input type='text' name='email' placeholder='email' /></font><tr> <font size='2' face='verdana'> <select name='class' type='dropdown'> <?php foreach($classes as $opt) printf("<option value='%1\$s'>%1\$s</option>", $opt); ?> </select> <td><input type='hidden' name='referer' value='<?php echo isset($_GET['referer']) && ctype_digit($_GET['referer']) ? abs(@intval($_GET['referer'])) : null; ?>' /> <font size='2' face='verdana'><br /><tr> <center><img src="antispam.php"/> <tr> <input type='text' name='anti_spam_code' /> <tr><input type='submit' name='submit' value='Register' /> </center> </td></tr>[\code] Edited April 28, 2014 by Adamhull1 Quote Link to comment https://forums.phpfreaks.com/topic/288082-help-aligning-css/ Share on other sites More sharing options...
adam_bray Posted April 28, 2014 Share Posted April 28, 2014 The HTML is all over the place, look at fixing that and see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/288082-help-aligning-css/#findComment-1477514 Share on other sites More sharing options...
Solution Adamhull1 Posted April 28, 2014 Author Solution Share Posted April 28, 2014 Problem solved Quote Link to comment https://forums.phpfreaks.com/topic/288082-help-aligning-css/#findComment-1477520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.