CSS Centering Problems - php

I'm having problems with my site i am currently trying to redesign it.
The site: Link
This is my css style-power.css
/* main body style */
body {
background: #c7ff9a;
color: #000000;
font-family: Tahoma, Verdana, sans-serif;
font-size: 12px;
margin: auto;
text-align:center;
}
.container {
width:1800px;
}
.bodycentre {
text-align: center;
width:1300px;
vertical-align:middle;
margin-left:40px;
margin-right:40px;
font-family: Tahoma, Verdana, sans-serif;
}
.header {
text-align:center;
vertical-align:middle;
background:url(../images/powerplay.png) center top no-repeat;
height:150px;
width:1300px;
margin: -10px 0 0 0;
border-bottom:2px solid #ddd;
border-left:2px solid #ddd;
border-right:2px solid #ddd;
box-shadow: 0 0 6px #000;
-moz-box-shadow: 0 0 6px #000;
-webkit-box-shadow: 0 0 6px #000;
padding: 4px 10px 4px 15px;
border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
}
.menu {
position:relative;
float:left;
z-index:5001;
width:190px;
height:215px;
margin: 0 0 0 -305px;
border: 2px solid #ddd;
box-shadow: 0 0 6px #000;
-moz-box-shadow: 0 0 6px #000;
-webkit-box-shadow: 0 0 6px #000;
padding: 4px 10px 4px 15px;
border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
}
.footer {
text-align: center;
vertical-align:baseline;
position: relative;
width:1300px;
}
Problem is that when you go to the link above the .menu div is not there i have fiddled with the css but it just doesn't center. Also when it did center the problem i also had was that when you zoomed in with the java-script zoom the menu was partly of the screen and you could not scroll over to it.
This is the code for the index page:
<link rel="stylesheet" type="text/css" media="screen" href="../styles/style-power.css" />
<div class="container">
<div class="header"></div>
<br />
<br />
<div class="menu">
<ul id="nav">
<p align="left"><strong>Power Play Pro Shop</strong></p>
<li>Home</li><br />
<li><strong>Deals</strong><ul>
<li>Balls</li>
<li>Bags</li>
<li>Shoes</li>
<li>Combos</li>
</ul></li>
<br>
<li>Doubles Home</li><br>
<li>Admin Login</li></ul>
</div>
<div class="bodycentre">
<h3>Power Play Pro Shop</h3>
<p> </p>
<h1>Deals</h1>
<p>Special Deals for the Bowlplex Doubles 2011</p>
<p>Balls</p>
<p>Bags</p>
<p>Shoes</p>
<p>Combos</p>
<p> </p>
<h2>Staff</h2>
<p><img src="../images/players_8_1.jpg" alt="Steve Thornton" width="150" height="200" border="1" /></p>
<p><strong>Steve Thornton</strong></p>
<p> </p>
<p> </p>
<p>For Admin Access Click Here</p>
</div>
<br />
<div class="footer">
<p>© 2011 David Passmore (David Passmore Web Development)</p>
</div>
</div>
Any help would be appreciated,
Thanks Guys and Girls!

Put it into your CSS:
.container > *{margin:0 auto}
There are a few other problems too. meta , link and code for IE should be in head, not body.

try,
.menu {
position:relative;
z-index:5001;
width:190px;
height:215px;
margin:0 auto;
border: 2px solid #ddd;
box-shadow: 0 0 6px #000;
-moz-box-shadow: 0 0 6px #000;
-webkit-box-shadow: 0 0 6px #000;
padding: 4px 10px 4px 15px;
border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
}
just i remove float:left; and margin:0 auto;
i don't why are you put float but i worked your fiddle link. menu going center the page.

Related

Processing multiple pages, radio button selections in a single instance and submit choices

My question1.blade.php
.privew {
margin-bottom: 20px;
}
.questionsBox {
display: block;
border: solid 1px #e3e3e3;
padding: 10px 20px 0px;
box-shadow: inset 0 0 30px rgba(000,000,000,0.1), inset 0 0 4px rgba(255,255,255,1);
border-radius: 3px;
margin: 0 10px;
}.questions {
background: #007fbe;
color: #FFF;
font-size: 22px;
padding: 8px 30px;
font-weight: 300;
margin: 0 -30px 10px;
position: relative;
}
.questions:after {
background: #1d68a7 no-repeat left 0;
display: block;
position: absolute;
top: 100%;
width: 9px;
height: 7px;
content: '.';
left: 0;
text-align: left;
font-size: 0;
}
.questions:after {
left: auto;
right: 0;
background-position: -10px 0;
}
.questions:before, .questions:after {
background: black;
display: block;
position: absolute;
top: 100%;
width: 9px;
height: 7px;
content: '.';
left: 0;
text-align: left;
font-size: 0;
}
.answerList {
margin-bottom: 15px;
}
ol, ul {
list-style: none;
}
.answerList li:first-child {
border-top-width: 0;
}
.answerList li {
padding: 3px 0;
}
.answerList label {
display: block;
padding: 6px;
border-radius: 6px;
border: solid 1px #dde7e8;
font-weight: 400;
font-size: 13px;
cursor: pointer;
font-family: Arial, sans-serif;
}
input[type=checkbox], input[type=radio] {
margin: 4px 0 0;
margin-top: 1px;
line-height: normal;
}
.questionsRow {
background: #dee3e6;
margin: 0 -20px;
padding: 10px 20px;
border-radius: 0 0 3px 3px;
}
.button, .greyButton {
background-color: #f2f2f2;
color: #888888;
display: inline-block;
border: solid 3px #cccccc;
vertical-align: middle;
text-shadow: 0 1px 0 #ffffff;
line-height: 27px;
min-width: 160px;
text-align: center;
padding: 5px 20px;
text-decoration: none;
border-radius: 0px;
text-transform: capitalize;
}
.questionsRow span {
float: right;
display: inline-block;
line-height: 30px;
border: solid 1px #aeb9c0;
padding: 0 10px;
background: #FFF;
color: #007fbe;
}
<body>
<div class="container">
<div class="privew">
<div class="questionsBox">
<div class="questions"><h1>Something</h1></div>
<div class="answerList"><h3>You are only allowed to select one option from the given below question</h3></div>
<div class="questions"><h4>Question 1</h4></div>
<div class="questions"><h3>Section 1</h3></div>
<ul class="answerList">
<li>
<label>
<input type="radio" name="answerGroup" value="0" id="answerGroup_0">Yes</label>
</li>
<li>
<label>
<input type="radio" name="answerGroup" value="1" id="answerGroup_1">Rather yes</label>
</li>
<li>
</ul>
</div>
<div class="questionsBox">
<div class="questions"><h3>Section 2</h3></div>
<ul class="answerList">
<li>
<label>
<input type="radio" name="answerGroup" value="2" id="answerGroup_2">Yes</label>
</li>
<li>
<label>
<input type="radio" name="answerGroup" value="3" id="answerGroup_3">Rather yes</label>
</li>
</ul>
</div>
<div class="questionsRow">Next<span>1 from 20</span>Previous</div>
</div>
</div>
<script type="text/javascript">
</script>
</body>
Hello All,
I'm trying to make a test page where users will select one radio button option and submit all selections in one instance in order to store back into the database. Also, questions are on different pages so basically user can move back and forth in order to edit its selection. There are 20 questions in total. I am unable to understand where shall I put my array logic. My best guess would be in a TestController. Please drop your valuable answer.
P.S : I am a beginner in Web Development and recently started to work on a Personality assessment website Project. However, due to less experience, I am facing a lot of challenges to achieve building it.
This problem is from my Laravel 6.x Project.
I expect to get all the selections stored in an array and passed to the database where I can further process it.

How to center an input tag in fieldset when using codeigniter?

I have created a signup page using Codeigniter and I want to center all of the elements in a fieldset.
Here is my PHP code:
<fieldset style="text-align:center">
<legend>Data</legend>
<?php
$this->load->helper('form');
echo form_open('login/create_user');
echo form_input('username', '', 'placeholder="Username"');
echo form_input('email', '', 'placeholder="Email"');
echo form_password('password', '', 'placeholder="Password"');
echo form_password('password1', '', 'placeholder="Confirm"');
echo form_submit('submit', 'Submit');
echo validation_errors();
?>
</fieldset>
CSS code:
input[name=username], input[name=email], input[type=password]
{
display: block;
margin: 0 0 1em 0;
width: 200px;
border: 5px;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
padding: 1em;
}
input[name=submit]
{
border: none;
margin-right: 1em;
padding: 6px;
font-size: 12px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background: #088A08;
color: white;
box-shadow: 0 1px 0 white;
-moz-box-shadow: 0 1px 0 white;
-webkit-box-shadow: 0 1px 0 white;
}
Here is how this look like: Page, and as you can see, only Submit button is centered, why is it so?
input[name=username], input[name=email], input[type=password]
{
display: block;
margin: 0 auto 1em; /* change here */
width: 200px;
border: 5px;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
padding: 1em;
}
You can always center a display:block using a width and margin-right: auto, margin-left: auto;

What could be the reason for this issue in my css?

I currently have built a form a form-field(pull down menu) and a button. The only issue I have run into is when I try to create another pull-down menu below the first it messes up my original pull-down menu by throwing the info out of the box. Can someone please take a look a see what I'm exactly doing wrong cause I'm not really sure why its happening.
<?php
$shows = array( "Sesame Street on Ice", "The Wiggles Live", "Dora Live" )
$prices = array( 29.99, 35.49, 49.95, 34.99, 9.99 );
?>
<html>
<head>
<title></title>
<style type="text/css">
body {
background: tan;
font-family: arial;
}
#contentwrap {
background-color: white;
border: 6px darkred solid;
padding: 110px;
width: 600px;
margin: 20px auto 20px auto;
border-radius: 25px;
-moz-border-radius: 25px;
}
#heading {
color: darkred;
font-size: 2.2em;
padding: 0px 0px 19px 0px;
margin: -70px -90px 5px -90px;
text-align: center;
}
#content {
height: 220px;
padding: 80px 0px 0px 0px;
background-repeat: no-repeat;
background-position: right;
}
#border {
color: lightblue;
border-bottom: 8px double;
padding: 0px 0px 65px 0px;
margin: -85px -80px 10px -80px;
}
#border2 {
color: darkred;
border-bottom: 8px double;
padding: 0px 0px 65px 0px;
margin: 180px -80px 0px -80px;
}
.formtext {
color: lightblue;
margin: -280px 0px 0px -50px;
}
.formtext2 {
color: lightblue;
margin: -10px 0px 0px -50px;
}
.formfield {
padding: 0px;
font-size: 1em;
width: 250px;
margin: 0px 0px 0px -50px;
color: black;
border: 2px darkred solid;
background-color: lightyellow;
border-radius: 4px;
}
</style>
</head>
<body>
<div id="contentwrap">
<div id="heading">Online Order Event Form</div>
<div id="border"></div>
<div id="content">
<div id="border2"></div>
<div class="formtext">Choose a show</div>
<select class="formfield" name="Show">
<div class="formtext">Select a number of tickets (max 4)</div>
<select class="formfield" name="Tickets">
<?php
for( $i = 0; $i < count( $shows ); $i++ ) {
echo "<option value=\"". $i ."\">". $shows[ $i ]
." $". $prices[ $i ] ."</option>\n";
}
?>
</select>
<div style="margin:160px 0px 80px -48px;">
<input type="submit" value="Order Tickets" />
</div>
</form>
</div> <!-- ends div#contentwrap -->
</body>
</html>
Your code has loads of <div> tags but no corresponding closing </div>.
There's also a </form> with no corresponding <form>.
Also consider using indentation for easier reading.
Edit: Okay, so it's something to do with your CSS and usage of margin to try and position things.

dynamic css per user

i have a gamimng section on my site that allow the user to display a quick status of their stats using colors (blue, red, and green).
i want to generate something like this based per user. i have this so far:
<style>
.box2 {
height: 20px;
background: blue;
float:left;
width:120px;
}
.box3 {
height: 20px;
background: green;
float:left;
width:30px;
}
.box1 {
height: 20px;
background: red;
float:left;
width:140px;
}
</style>
<div>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</div>
should i put the css directly in the page? what will be the best way to implement this using php?
You can always use a generated file using PHP and include it as your CSS file like:
<link rel="stylesheet" type="text/css" href="/css/userstats.php" />
Then in this file you can use the current session to find out the user stats then generate using PHP. Don't forget the put the header:
header("Content-type: text/css");
Example php:
background: #<?php echo $colorX; ?>; // assuming the $colorX is HEX
You can also if you prefer use .htaccess to rewrite the file so it looks less obvious like:
RewriteEngine On
RewriteBase /
RewriteRule ^css/userstats.css$ /path/to/generatedfile.php [L,NC]
So you can use:
<link rel="stylesheet" type="text/css" href="css/userstats.css" />
example code:
<style>
div.bar {
height: 25px;
}
div.bar div {
display: block;
float:left;
height: 25px;
margin: 0;
padding: 0;
position: relative;
}
div.bar div.red {
background: #DD3030;
-webkit-box-shadow: -5px 0px 8px 2px #DD3030;
-moz-box-shadow: -5px 0px 8px 2px #DD3030;
box-shadow: -5px 0px 8px 2px #DD3030;
width:140px;
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 0px;
-moz-border-radius-bottomright: 0px;
-moz-border-radius-bottomleft: 8px;
-webkit-border-radius: 8px 0px 0px 8px;
border-radius: 8px 0px 0px 8px;
z-index:10;
}
div.bar div.blue {
background: #3388DD;
-webkit-box-shadow: 0px 0px 8px 2px #3388DD;
-moz-box-shadow: 0px 0px 8px 2px #3388DD;
box-shadow: 0px 0px 8px 2px #3388DD;
width:120px;
z-index:5;
}
div.bar div.green {
background: #1CAD32;
-webkit-box-shadow: 5px 0px 8px 2px #1CAD32;
-moz-box-shadow: 5px 0px 8px 2px #1CAD32;
box-shadow: 5px 0px 8px 2px #1CAD32;
width:30px;
-moz-border-radius-topleft: 0px;
-moz-border-radius-topright: 8px;
-moz-border-radius-bottomright: 8px;
-moz-border-radius-bottomleft: 0px;
-webkit-border-radius: 0px 8px 8px 0px;
border-radius: 0px 8px 8px 0px;
z-index:10;
}
</style>
<div class="bar">
<div class="red"></div>
<div class="blue"></div>
<div class="green"></div>
</div>
jsfiddle: http://jsfiddle.net/g9Vrx/
If the colors are fully customizable, then the best way is to either generate the CSS each time the page loads per user, or generate it once when the user changes the colors in his preferences, and store it in a cache or db. Then just extract it and use it.
Again, if the colors are fully customizable (not like a couple of predefined colors) you should include the CSS in the HTML page since modifying external CSS files with PHP is rather complicated and unnecessary.

Why is my "Page [0]" not centered in my webpage?

My "Page [0]" text isn't centered on my webpage. Anyone know why? I could really use some help please.
Here is the html:
<html>
<head>
<title>Test Forum</title>
<link href="http://prime.programming-designs.com/test_forum/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<img src="http://prime.programming-designs.com/test_forum//images/banner1.png" alt="" id="banner" />
<h1>Test Forums</h1>
<hr />
<div id="navi"><div id="naviheader">Boards</div>Testing<br />General Discussion<br />Video Games<br />Anime and Manga<br />BlazBlue<br />Shin Megami Tensei<br />Earthbound<br />Phantasy Star<br />Mobile Suit Gundam<br /></div>
<div class="postbox"><h4>CyanPrime</h4><hr />Welcome to the King's Gate BBS!</div>Page: [0]
</body>
</html>
Here is the CSS:
#charset "windows-1252";
body{
background-color: #EEFFF8;
color: #000000;
text-align: center;
}
.postbox{
text-align: left;
margin: auto;
background-color: #dbfef8;
border: 1px solid #82FFCD;
width: 50%;
margin-top: 10px;
}
.stickypostbox{
text-align: left;
margin: auto;
background-color: #F5FFFA;
border: 1px solid #82FFCD;
width: 50%;
margin-top: 10px;
}
h4{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
color: #9932CC;
}
h1{
color: #551A8B;
}
hr{
color: #82FFCD;
background-color: #82FFCD;
height: 1px;
border: 0px dotted #82FFCD;
}
a{
color: #7F00FF;
text-decoration: none;
}
a:hover{
color: #7F00FF;
text-decoration: underline;
}
form{
margin: 0px auto;
width: 50%;
}
#formdiv {
background-color:#dbfef8;
border:1px solid #82FFCD;
}
.fielddiv1{
background-color: #f9f9f9;
border: 1px solid #DBFEF8;
vertical-align: middle;
width: 45%;
float: left;
}
.fielddiv2{
background-color: #f9f9f9;
border: 1px solid #DBFEF8;
vertical-align: middle;
width: 100%;
}
.fieldtext1{
width: 50%;
background-color: #82FFCD;
float: left;
}
.fieldtext2{
width: 100%;
background-color: #82FFCD;
}
#replydiv{
width: 100%;
background-color: #DBFEF8;
margin: 10px 0 10px 0;
}
#admindiv{
width: 100%;
background-color: #DBFEF8;
margin: 10px 0 10px 0;
}
#navi{
width: 200px;
background-color: #dbfef8;
border: 1px solid #82FFCD;
text-align: left;
float: left;
}
#naviheader{
width: 100%;
background-color: #82FFCD;
}
#submitbutton{
border: 1px solid #82FFCD;
background-color: #DBFEF8;
color: #000000;
margin-top: 5px;
width: 100px;
height: 20px;
}
#banner{
border: 1px solid #82FFCD;
}
.postbar{
margin-right: 0px;
margin-top: 0px;
}
.bannedtext{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
color: #FF0000;
}
And here is the webpage so you can get some context (you'll notice that my "page [0]" is centered on the other boards, but not the index. http://prime.programming-designs.com/test_forum/
The float on the left is pushing the content to the right. It's still centred across the line, but it's not centred across the page. Adding a large bottom margin to .postbox illustrates this.
Centreing problem illustrated http://img169.imageshack.us/img169/9027/williamhtmlproblem.png
My suggestion would be to wrap the footer in a <div>. Either clear: both; (or just left), add margins on either end to compensate for the floated element, or give it position: absolute; left: 0; right: 0; to force centreing across the page.
Change:
Page: [0]
To (wrap it in a div with pager class):
<div class="pager">Page: [0]</div>
Change this in your CSS:
.postbox, .pager{
text-align: left;
margin: auto;
width: 50%;
margin-top: 10px;
}
.postbox {
background-color: #dbfef8;
border: 1px solid #82FFCD;
}
.pager {
text-align: center;
}
The reason this is happening is because your float is pushing over your content. You pager is coming straight off the body tag. In general, it's best to wrap plain text inside an html element.
You may want to revisit the structure of your page. Create a left column and a center column div or something like that.

Categories