Form outside table php - php

I have a problem with mapping together table and form. In my table I have some values that with help of a form I want to redirect to a page.I have read that I cannot put a form into a table so I tried not to. But if I let
<form>
<table>
structure, my display on page isn't very nice and I am not responsabile with frontend part but anyway I want to not be problems with it.If I let the table, without the form the display is ok(like in image). An image in left page and the table with the information in the right part. When using form, the table goes down and it's not good. So how to do? I try to include an image here to see how my page looks like without the form, but I really need to use the form. Any suggestion how to resolve this?I mean it's possible to have the display like in the photo but plus using a form and to not change the display?
EDIT: the css where tables are displayed
/* ==========================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
text-align: left;
}
table th {
padding-right: 40px;
}
html {overflow-y: scroll; overflow-x: hidden;}
body {font-family: 'Open Sans', sans-serif; background:#f0eeed; color: #676767;}
.wrapper {width: 980px; margin: 0 auto;}
#content {padding: 20px 0 80px;}
.header:after {content:"";height:0;display:block;visibility:hidden;clear:both;}
.header {background: #ef8887; border-bottom: 3px solid #db7a78;}
.header .branding-title {float: left; margin: 0 0 0 5px; font: 0/0 serif; text-shadow: none; color: transparent; width:225px; height:125px;background:url(../img/branding-title.png) 0 6px no-repeat;padding: 6px 0;}
.header .branding-title a {display: block; height: 125px; width: 225px;}
.header .nav {float: right; top: 10; right: 0; margin: 0; position: relative; left: 15px; z-index: 99999999;}
.header .nav li {display: inline-block; margin: 0; list-style: none;}
.header .nav li a {
color: white;
text-decoration: none;
display: block;
line-height: 95px;
padding: 10px 0 0;
margin: 0 0 0 50px;
width: 100px;
text-align: left;
background: url('../img/nav-sprite.png') no-repeat 0px 105px;
white-space: nowrap;
text-transform: uppercase;
letter-spacing: 1px;
}
.header .nav li.on a {text-decoration:underline;}
.header .nav li a:hover, .header .nav li a:active {opacity: 0.7;}
.header .nav li.books a {background-position: 8px -5px;}
.header .nav li.movies a {background-position: 13px -105px;}
.header .nav li.music a {background-position: 15px -235px;}
.header .nav li.suggest a {background-position: 35px -340px;}
#content {min-height: 400px; background: white;}
.section.page:after {content:"";display:block;visibility:hidden;height:0;clear:both;}
.section.page {padding: 34px 0; background: white;}
.section.page h1 {
font-size: 24px;
text-align: center;
line-height: 1.6;
font-weight: normal;
}
.section.page .media-details h1 {
text-align: left;
}
.section.page p {width: 475px; margin-left: auto; margin-right: auto; }
.section.page .media-details h1 .price {color: #9d9f4e; padding-right: 10px; font-size: 34px;}
.section.catalog {padding-bottom: 42px;}
.section.catalog h2 {
font-size: 24px;
text-align: center;
line-height: 1.6;
font-weight: normal;
padding-top: 20px;
}
.section.catalog ul.items {margin: 0 0 -17px 0; padding: 0; width: 997px;}
.section.catalog ul.items li {
display: inline-block;
list-style: none;
width: 204px;
text-align: center;
padding: 14px;
margin: 0 0 17px 17px;
position: relative;
left: -17px;
}
.section.catalog ul.items li a:hover:after {
content: '+';
font-size: 50px; position: absolute; top:35px; right:30px; color: #3888c2; vertical-align: top;
}
.section.catalog ul.items li a {
background: white;
display: block;
padding: 30px 0 10px;
text-decoration: none;
}
.details-button {
color: #888;
}
.section.catalog ul.items li a:hover {
opacity: 1;
color: #666;
}
.section.catalog ul.items li img {
width: 190px;
border: 6px solid #f0eeed;
}
.section.catalog ul.items li p {
margin-left: 0;
margin-right: 0;
width: auto;
}
.media-picture {
float: left;
width: 400px;
text-align: center;
border: 1px solid #d9d9d9;
padding: 14px;
background: #f0eeed;
}
.media-picture span {
background: white;
display: block;
width: 100%;
padding: 36px 0 61px;
}
.media-picture img {width: 292px;}
.media-details {
width: 460px;
float: right;
}
.media-details form {
margin-left: 0;
}
td, th {
padding: 5px 5px;
}
form {width: 475px; margin: 34px auto;}
form tr, tr {text-align:left;vertical-align: top; padding:2px;}
form table {width: 475px; margin-bottom: 16px;}
form th {
width: 150px;
vertical-align: middle;
padding: 8px;
}
form td {
padding: 15px 15px;
}
form td select,
form td input,
form td textarea {
width: 100%;
border-radius: 4px;
padding: 10px;
border: 1px solid #a5a5a5;
font-size: 14px;
font-family: 'Open Sans', sans-serif;
}
form input[type="submit"] {
width: 475px;
text-align: center;
border: 0;
background: #3888c2;
color: #FFF;
-webkit-border-radius: 4px;
border-radius: 4px;
font-size: 16px;
padding: 14px 0 16px;
font-family: 'Open Sans', sans-serif;
}
form input[type="submit"]:hover {
background: #358dce;
cursor: pointer;
}
.search {
background: #f0eeed;
border-bottom: 3px solid #dddddd;
width:100%;
text-align:right;
}
.search form {
margin: 5px 5px 5px auto;
}
.search form input[type="submit"] {
width: auto;
text-align: center;
border: 0;
background: #3888c2;
color: #FFF;
-webkit-border-radius: 4px;
border-radius: 4px;
font-size: 16px;
padding: 6px;
font-family: 'Open Sans', sans-serif;
}
.page p.message {
background: #ffeca4;
border: 1px solid #f16702;
padding: 1em;
width: 444px;
}
.breadcrumbs {
font-size: 14px;
font-weight: normal;
padding: 14px 0 48px;
}
.breadcrumbs a {
text-decoration: none;
color: #3888c2;
}
.note-designer {
font-size: 14px;
font-style: italic;
font-weight: bold;
}
.footer {
background: #f0eeed;
border-top: 3px solid #dddddd;
padding: 42px 0;
font-size: 12px;
color: #a5a5a5;
}
.footer ul {margin: 0; padding: 0; float: left;}
.footer ul li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
.footer ul li:after {content:" | "}
.footer ul li:last-child:after {content:"";}
.footer p {margin: 0; padding-right: 3px;}
.footer a {text-decoration: none; color: #539def; margin: 0 10px;}
.footer li:first-child a {margin-left: 4px;}
.footer a:hover, .footer a:active {text-decoration: underline;}
sorry for the long code but this is what I found in style css

As mentioned previously, avoid using tables for anything but actual tabular data. Using it to position elements on the page is unpredictable at best.
You said that you aren't responsible for the front end, but do you have access to the HTML? I'm sure many of us could give you some helpful suggestions but we need a reference point beyond a screenshot :).
You might want to check out how some CSS frameworks handle this, it might give you some inspiration (http://getbootstrap.com/css/#forms). I'm not a big Bootstrap guy but there are a lot of basic examples here on form / table formatting.

You should be able to put just about anything inside a form tag without affecting the way anything on the page looks. Assuming you can't just stop using tables asap, you may have to play around with the css to clean this up. If the form tag is affecting the way anything embedded inside it looks then you might have something in your CSS styling the form element. If possible I would eliminate this styling if it exists.

Related

Login Drop down with html

I want to make a dropdown menu when you are logged in to add a spot for my account and the orders, etc..
My Mess of a page (When logged in):
Heres my code, but it doesnt really do anything but make a mess of my site. (Take note the some of the php was me attempting to display the users name on the page next to welcome.)
<?php
if (isset($_SESSION['userId'])) {
require './includes/dbh.inc.php';
/*$sql = mysqli_query($conn,"SELECT fnidUser, lnidUsers FROM users"); */
$result = mysqli_query($conn, "SELECT fnidUser FROM users");
echo "
<li class='login current2'><a href='#'>Welcome</a>
<ul>
<li class='login'><a href='#'>My Account</a></la>
<li class='login'><a href='#'>My Orders</a></la>
<li class='login'><a href='#'>My Wishlist</a></la>
<li class='login'><a href='#'>My Cart</a></la>
<li class='login'><a action='./includes/logout.inc.php' method='post' name='logout-submit'>Log out</a></la>
</ul>
</li>
";
}
else{
echo "<li class='login current2'><a href='login.php'>Login / Sign up</a></li>";
}
?>
Here is all my styling for the page.
/* Global */
.container{
width: 80%;
margin: auto;
overflow: hidden;
}
ul{
margin: 0;
padding: 0;
}
.button_1 {
height: 49px;
width: 144px;
background: #FF3B3F;
border: 0;
padding-left: 20px;
padding-right: 20px;
color: white;
font-size: 25px;
border-radius: 8px;
cursor: pointer;
}
.button_1:hover{
background-color: #752021;
color: #CCCCCC;
}
.button_1, .roundbutton:focus{
outline: 0;
}
img{
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
body{
font: 15px/1.5 Arial;
padding: 0;
margin: 0;
background-color: #EFEFEF;
}
.footerc{
float: left;
}
.footerb{
float: right;
}
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Login Page Stuff */
#login_page{
margin-top: 65px;
margin-right: 150px;
margin-bottom: 65px;
margin-left: 150px;
min-height: 500px;
}
#login_page h1{
text-align: center;
color: #FF3B3F;
font-size: 50px;
text-shadow: 2px 2px 12px #000000;
}
/* Header */
header{
background: #35424A;
color: #FFFFFF;
padding-top: 30px;
min-height: 70px;
border-bottom: #FF3B3F 5px solid;
}
header ul a{
color: #FFFFFF;
text-decoration: none;
text-transform: uppercase;
font-size: 24px;
}
header li{
float: left;
display: inline;
padding: 0px 20px 0px 20px;
}
header #branding{
float: left;
}
header #branding h1{
margin: 0;
}
header nav{
float: right;
margin-top: 25px;
margin-right: 100px;
}
header .highlight, header .current a{
color: #FF3B3F;
font-weight: bold;
}
header .current2 a{
color: #FF3B3F;
}
header a:hover{
color: #CCCCCC;
}
.login a{
color: #FFFFFF;
text-decoration: none;
float: right;
}
.login {
color: #FFFFFF;
text-decoration: none;
float: right;
margin-top: -10px;
margin-right: 10px;
}
/* Login Form Style */
section #login_page td .form{
margin-bottom: 25px;
}
/*Showcase*/
#showcase{
min-height: 500px;
background:url('../img/iphone_showcase.png') no-repeat -50px -50px;
border-bottom: #FF3B3F 5px solid;
/*Scroll Parallax*/
background-attachment: fixed;
}
#showcase h1{
text-align: center;
color: #FF3B3F;
margin-top: 200px;
font-size: 50px;
text-shadow: 4px 4px 12px #000000;
}
/* Boxes */
#boxes{
margin-top: 65px;
}
#boxes .box{
float: left;
width: 30%;
padding: 25px;
}
#boxes .button_1{
align-content: center;
}
#boxes .box2{
float: left;
width: 48%;
min-height: 100px;
}
/* Footer */
footer{
padding: 20px;
margin-top: 200px;
border-top: #FF3B3F 5px solid;
background-color: #35424A;
color: white;
font-weight: bold;
}
footer .fpara, footer .logo{
margin-left: 100px;
}
footer nav{
float: right;
}
footer li{
float: left;
display: inline;
padding: 0px 20px 0px 20px;
}
.fbhover{
background: url('../footer image/facebook_hover_no.png') no-repeat;
border-radius: 50%;
height: 35px;
width: 35px;
margin-top: 42px;
padding: 8px;
cursor: pointer;
background-size: 100%;
transition: 0.5s;
box-sizing: border-box;
}
.fbhover:hover{
background: url('../footer image/facebook_hover_yes.png') no-repeat;
background-size: 100%;
}
.instahover{
background: url('../footer image/insta_hover_no.png') no-repeat;
border-radius: 50%;
height: 35px;
width: 35px;
margin-top: 42px;
padding: 8px;
cursor: pointer;
background-size: 100%;
transition: 0.5s;
box-sizing: border-box;
}
.instahover:hover{
background: url('../footer image/insta_hover_yes.png') no-repeat;
background-size: 100%;
}
.trhover{
background: url('../footer image/twitter_hover_no.png') no-repeat;
border-radius: 50%;
height: 35px;
width: 35px;
margin-top: 42px;
padding: 8px;
cursor: pointer;
background-size: 100%;
transition: 0.5s;
box-sizing: border-box;
}
.trhover:hover{
background: url('../footer image/twitter_hover_yes.png') no-repeat;
background-size: 100%;
}
.sphover{
background: url('../footer image/support_hover_no.png') no-repeat;
border-radius: 50%;
height: 35px;
width: 35px;
margin-top: 42px;
padding: 8px;
cursor: pointer;
background-size: 100%;
transition: 0.5s;
box-sizing: border-box;
}
.sphover:hover{
background: url('../footer image/support_hover_yes.png') no-repeat;
background-size: 100%;
}
/* Apple Store */
section #applestore{
margin-top: 65px;
}
/* Store Sections */
#main {
padding:20px 0;
}
#content {
overflow: hidden;
}
#content #left, #content #right {
float: left;
margin: 0 2%;
width: 63%;
}
#content #right {
margin-left: 0;
width: 30%;
}
#content h3 {
background: -moz-linear-gradient(#ffffff, #F6F6F6); /* FF 3.6+ */
background: -ms-linear-gradient(#ffffff, #F6F6F6); /* IE10 */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #F6F6F6)); /* Safari 4+, Chrome 2+ */
background: -webkit-linear-gradient(#ffffff, #F6F6F6); /* Safari 5.1+, Chrome 10+ */
background: -o-linear-gradient(#ffffff, #F6F6F6); /* Opera 11.10 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#F6F6F6'); /* IE6 & IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#F6F6F6')"; /* IE8+ */
background: linear-gradient(#ffffff, #F6F6F6); /* the standard */
border-bottom: 1px solid #E0E0E0;
color: #3C3C3C;
font-size: 12px;
font-weight: bold;
line-height: 15px;
padding: 11px 0 12px 20px;
text-transform: uppercase;
}
#content ul {
list-style:none outside none;
margin:0;
padding:0;
}
#content #left ul li {
float:left;
padding-bottom: 21px;
width: 33%;
}
#content #left ul li:hover {
background-color: #fbfbfb;
}
#content #right ul li {
border-top: 1px solid #E7E7E7;
overflow: hidden;
}
#content #right ul li:hover {
background-color: #fbfbfb;
}
#content #right ul li:first-child {
border-width: none;
}
#content #left ul li .img {
text-align: center;
}
#content #right ul li .img {
background-color: #FFFFFF;
float: left;
height: 94px;
text-align: center;
width: 113px;
}
#content #left ul li .img img {
height:128px;
width:128px;
}
#content #right ul li .img img {
height:70px;
margin-top: 11px;
width:70px;
}
#content #left ul li .info {
padding: 17px 20px 0 19px;
}
#content #right ul li .info {
float: left;
overflow: hidden;
padding: 17px 0 0 21px;
width: 164px;
}
#content ul li .info .title {
color: #4B4B4B;
display: inline-block;
font-size: 11px;
font-weight: bold;
line-height: 16px;
text-decoration: none;
text-transform: uppercase;
width: 150px;
}
#content ul li .info .title:hover {
color: #049733;
}
#content #left ul li .info p {
color: #7F7F7F;
font-size: 11px;
line-height: 16px;
padding-top: 3px;
}
#content #left ul li .info .price {
background: none repeat scroll 0 0 #F7F7F7;
color: #383838;
font-size: 12px;
font-weight: bold;
line-height: 16px;
margin: 17px 0 10px;
padding: 6px 0 6px 8px;
}
#content #right ul li .info .price {
color: #383838;
font-size: 12px;
font-weight: bold;
line-height: 16px;
padding-top: 25px;
}
#content #left ul li .info .price .st {
color: #7F7F7F;
font-size: 11px;
line-height: 16px;
margin-right: 3px;
}
#content #right ul li .info .price .usual, #content #right ul li .info .price .special {
color: #7F7F7F;
font-size: 12px;
font-weight: normal;
line-height: 16px;
padding-right: 6px;
text-decoration: line-through;
}
#content #right ul li .info .price .special {
color: #FD7A01;
font-weight: bold;
text-decoration: none;
}
#content #left ul li .info .actions {
overflow:hidden;
}
#content #left ul li .info .actions a {
border: 1px solid #E0E0E0;
color: #fd7a01;
display: block;
float:right;
font-size: 11px;
font-weight: bold;
line-height: 16px;
padding: 5px;
text-decoration: none;
}
#content #left ul li .info .actions a:first-child {
color: #009832;
float:left;
}
This is kind of what I'm looking for but like text no image..
Thanks for the help :)
hi try this css from w3school for drop down using hover,
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
<div class="dropdown">
<li class='login current2'><a href='#'>Welcome</a>
<div class="dropdown-content">
<ul>
<li class='login'><a href='#'>My Account</a></la>
<li class='login'><a href='#'>My Orders</a></la>
<li class='login'><a href='#'>My Wishlist</a></la>
<li class='login'><a href='#'>My Cart</a></la>
<li class='login'><a action='./includes/logout.inc.php'
method='post' name='logout-submit'>Log out</a></la>
</ul>
</div>
</li>
</div>

How to add space between menu elements (in wordpress)?

I am working in wordpress and I have this menu with 4 menu items.
The problem is that they are touching each other and there is 0
space between which makes it ugly in my opinion.
Now this problem only
occurs in wordpress. So I have to find a solution how to put some space between.
Maybe you guys know a solution without having to install something on WP.
(the codes in the body is exactly as in my wordpress to demonstrate how it looks like. You can enter it and that will put some space between, but unfortunately that doesn't work in wordpress.)
<style>
.smallmenu {
margin: 0 auto;
max-width: 436px;
width: 100%;
}
.Capital {
margin: 0px 0 -5px 0;
line-height: 63px;
font-size: 60px;
font-weight: ligter;
}
.smalltext {
text-align: center;
margin-top: 0px !important;
font-weight: 100px;
font-size: 14px;
}
.smalltextpub {
text-align: center;
margin-top: 0px !important;
font-weight: 100px;
font-size: 14px;
margin-left: -5px;
}
.cornermenu {
display: inline-block;
margin: auto;
border-radius: 25px;
background: #769DBD;
padding: 20px;
width: 100px;
height: 100px;
text-align: center;
color: #fff;
font-family: Arial;
padding-top: 10px;
text-decoration: none;
}
#hoverr:hover {
border-radius: 25px;
background: #464646;
padding: 20px;
width: 100px;
height: 100px;
text-align: center;
color: #fff;
font-family: Arial;
padding-top: 10px;
text-decoration: none;
}
* {
box-sizing: border-box;
}
</style>
<div class="smallmenu"><a id="hoverr" class="cornermenu" href="#methods"><span class="Capital">M</span>
<span class="smalltext">Methods</span></a><a id="hoverr" class="cornermenu" href="#background"><span class="Capital">B</span>
<span class="smalltextpub">Background</span></a><a id="hoverr" class="cornermenu" href="#results"><span class="Capital">R</span>
<span class="smalltext">Results</span></a><a id="hoverr" class="cornermenu" href="#publications"><span class="Capital">P</span>
<span class="smalltextpub">Publications</span></a></div>
Just set a fixed margin on .cornermenu.
Something like margin: 2px
JSFiddle link
.cornermenu {
...
margin: 2px;
...
}

what to do with the gap on my css drop down menu?

I badly need help with my css coding. newbie here.
#accountTitle
padding: 0;
display: block;
margin-top: 90px;
margin-bottom: -120px;
margin-left: 50px;
font-size: 36px;
a:active
background-color: #a6d8a8;
table
margin-left: auto;
margin-right: auto;
width: 100%;
margin-top: 50px;
overflow-x:auto;
td
text-align:left;
th, td
padding: 15px;
th
background-color: #4CAF50;
color: white;
text-align: center;
tr:hover
background-color: #a6d8a8;
cursor: pointer;
#container
margin-top: 135px;
position: relative;
padding: 0;
overflow: hidden;
background-color: #333;
border-radius: 10px;
width: 100%;
.wrap
margin-right: 10px;
text-align: center;
.dropbtn
background-color: #333;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
.dropdown
position: relative;
display: inline-block;
margin-right: 5px;
.dropdown-content
display: none;
position: fixed;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 2;
.dropdown-content a
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
.dropdown-content a:hover
background-color: #f1f1f1
.dropdown:hover .dropdown-content
display: block;
.dropdown:hover .dropbtn
background-color: #434343;
<label id="accountTitle">Audit Log</label>
<div id="container">
<div class="wrap">
<div class="dropdown">
<button class="dropbtn" id="homebtn">Home</button>
<div class="dropdown-content">
Main Page
Accounts
Audit Log
Logout
</div>
</div>
The problem here is that, whenever I scroll down this happens
please i really need to finish this.
take the overflow out of #container and change the position on .dropdown-content to absolute
#container {
...
padding: 0;
/* overflow: hidden; DELETE THIS */
background-color: #333;
...
}
.dropdown-content {
display: none;
position: absolute;
...
}
Reduce the padding of .dropdown-content a should be like this
.dropdown-content a
{
color: black;
padding: 0px 16px;
text-decoration: none;
display: block;
text-align: left;
}
I do not understand the problem very well but if the problem is that dropdown is not appearing at all then you have to change your .dropdown:hover .dropdown-content like this.
.dropdown:hover .dropdown-content{
display: block;
z-index: 1;
}
z-index change html rendering priority according to the number it has, the bigger number is the bigger the priority is.

Centered in Chrome - Is on the left in Firefox

I've been designing my site re-learning CSS after taking a long time, and have been essentially creating a website (integrated with WordPress) by basically doing as little as possible with the HTML/PHP, and trying to design it all from the CSS and available CLASS and IDs setup for me by a template theme. (Blankslate Theme)
This entire time it's been coming along fine in Chrome. I decided before I got too far to check it out on Firefox. Firefox decides everything should be squished to the LEFT, while in Chrome the site looks perfectly centered and matches things I try to do in the CSS.
I tried to align both the WRAPPER, Body, and even HTML to center the entire page, but Firefox refuses to do so. My fixed sidebar on the right is suppose to be spaced away from the main content, which it is in Chrome (unless you increase the size of the entire page, then it overlaps.) In Firefox, it doesn't even try to go as far right as possible, it just squishes in with everything else.
I've also wanted to use Ellipsis to cut off the text in the Sidebar if it's too long, however it refuses to work. It either cuts the text off, but does not substitute ellipsis, or runs off the page.
Below is the structure I'd like:
http://www.icesage.com/i/site2.png
Here is the CSS I'm using. As for the PHP/HTML structure you'll need to go to the actual website itself as there are too many to show here. (Again, it's WordPress, and uses the theme Blankslate as a starting point.)
body {
background-color: black;
background-repeat:no-repeat;
background-attachment:fixed;
background-size: 110%;
line-height: 20px;
text-size: 10px;
font-family: Verdana;
}
#site-title {
position:relative;
top:0px;
margin: 0 auto;
width: 10%;
display:none;
}
/* #header {
position:relative;
top:0px;
margin: 0 auto;
width: 40%;
} */
#footer {
position: relative;
float: right;
bottom: 0;
margin: 2% auto;
right: 25%;
width: 50%;
height: 10px; /* Height of the footer */
background-color:rgba(0,0,0,0.7);
border-radius: 10px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
text-align: center:
padding-top: 5px;
padding-bottom: 9px;
padding-right: 5px;
padding-left: 5px;
display: inline
}
#copyright {
text-align: center;
}
/* Top Navigation */
#menu {
margin: 0 auto;
}
#menu a {
float: left;
color: white;
display: block;
height: 40px;
line-height: 40px;
text-decoration: none;
text-align: center;
margin-right: 10px;
border-left-style: solid;
border-width: 1px;
border-color: #1c6191;
background-color:rgba(0,0,0,0.9);
border-radius: 10px;
box-shadow: 4px 0px 2px 3px #1c6191;
padding-top: 0px;
padding-bottom: 0px;
padding-right: 15px;
padding-left: 15px;
}
#menu a:hover {
background-color: blue;
}
.entry-title {
font-size: large;
width:60%;
text-shadow: 2px 0.5px #1c6191;
background-color:rgba(0,0,0,0.7);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 5px;
padding-left: 5px;
margin: 2px
}
/* h1 .entry-title {
display: none;
font-size: 50px;
}
h2 .entry-title {
display:none;
font-size: 50px;
}
h3 .entry-title {
font-size: 50px;
text-shadow: 2px 0.5px #1c6191;
}
h3 .widget-title {
font-size: 50px;
text-shadow: 2px 0.5px #1c6191;
}
*/
.cat-links {
display:none;
}
/* Main Content Post (Entry) */
.post {
width: 70%;
background-color:rgba(0,0,0,0.9);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 30px;
margin-left: 5px;
}
img.alignright {float:right; margin:20px 10 10em 10em; background-color: royalblue; border: 1px;}
img.alignleft {float:left; margin:20px 10em 2em 2em;}
img.aligncenter {display: block; margin-left: auto; margin-right: auto}
.alignright {float:right; text-align:center; padding-left: 20px;}
.alignleft {float:left; }
.aligncenter {display: block; margin-left: auto; margin-right: auto}
.wp-caption-text {
font-size: small;
font-style:italic;
text-align:center;
}
.post-edit-link {
float: left;
color: white;
position: relative;
display: block;
height: 40px;
line-height: 40px;
text-decoration: none;
text-align: center;
margin-right: 10px;
border-left-style: solid;
border-width: 1px;
border-color: #1c6191;
background-color:rgba(0,0,0,0.9);
border-radius: 10px;
box-shadow: 4px 0px 2px 3px #1c6191;
padding-top: 0px;
padding-bottom: 0px;
padding-right: 15px;
padding-left: 15px;
}
.post-edit-link:hover {
background-color: blue;
}
.comments-link {
float: right;
color: white;
display: block;
position: relative;
height: 40px;
line-height: 40px;
text-decoration: none;
text-align: center;
margin-right: 10px;
border-left-style: solid;
border-width: 1px;
border-color: #1c6191;
background-color:rgba(0,0,0,0.9);
border-radius: 10px;
box-shadow: 4px 0px 2px 3px #1c6191;
padding-top: 0px;
padding-bottom: 0px;
padding-right: 15px;
padding-left: 15px;
}
.comments-link:hover {
background-color: blue;
}
.type-page {
width: 70%;
float: left;
background-color:rgba(0,0,0,0.9);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 40px
overflow: auto;
}
.nav-previous {
display: none;
}
.comments {
width: 70%;
float: left;
background-color:rgba(0,0,0,0.9);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 20px
}
.comment {
width: 70%;
float: left;
background-color:rgba(0,0,0,0.9);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 20px
}
#header {
width: 60%;
margin: 0 auto;
background-color:rgba(0,0,0,0.7);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin-bottom: 40px;
}
#titlebanner {
margin: 0 auto;
}
.meta-sep {
display: none;
}
html {
zoom: .8;
-moz-transform: scale(0.8);
-moz-transform-origin: 0 0;
margin: 20px auto;
}
.comment-respond {
color: white;
width: 60%;
float: left;
background-color:rgba(0,0,0,0.7);
border-radius: 20px;
margin: 0 auto;
box-shadow: 5px 0px 4px 0px #1c6191;
font-color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
}
.entry-date {
color: royalblue;
}
#wrapper {
-moz-margin-start: -40px auto;
margin-right: 0 auto;
}
/* Sidebar */
.widget-area {
position: fixed;
top: 225px;
z-index: 1;
right: 0.5%;
text-shadow: 2px 2px #1c6191;
width: 300px;
float:left;
border-left-style: solid;
border-width: 1px;
border-color: #1c6191;
background-color:rgba(0,0,0,0.9);
border-radius: 10px;
box-shadow: 4px 0px 2px 3px #1c6191;
color: white;
padding-top: 0px;
padding-bottom: 0px;
padding-right: 0px;
padding-left: 0px;
margin-right: inherit;
}
.xoxo {
display:block;
padding-top: 2px;
padding-bottom: 2px;
padding-right: 2px;
padding-left: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: clip
text-overflow: ellipsis
text-overflow: "…"
}
#searchsubmit {
display:none;
}
.searchform .screen-reader-text {
display:none;
}
.xoxo .screen-reader-text {
display:none;
}
.entry-content {
width: 90%;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 25px;
padding-left: 25px;
text-align:justify;
/* text-shadow: 2px 0.5px #1c6191; */
}
P {
color: white;
}
#search {
display:none
}
#site-description {
display:none
}
A {
text-decoration: none;
font-family:Verdana;
}
A:link {
text-decoration: none;
color:#04CCFD;
font-family:Verdana;
}
A:visited {
text-decoration: none;
color:#04CCFD;
font-family:Verdana;
}
A:active {text-decoration: none;
color:#04CCFD;
}
A:hover {
text-decoration: none;
color:white;
}
li .widget-container {
font-color: white;
}
/* Sub-Menu Test */
/* End Sub-Menu Test */
video{font-size:100%;font:inherit;padding:0;border:0;margin:0;vertical-align:baseline}
ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}
table{border-collapse:collapse;border-spacing:0}
section{display:block}
.clear{clear:both}
.sticky{}
.bypostauthor{}
.wp-caption{}
.wp-caption-text{}
.gallery-caption{}
.alignright{}
.alignleft{}
.aligncenter{}
Website: http://www.icesage.com
Or you can take a look at "Blankslate."
Any help in figuring out what I'm doing wrong or pointing out some sloppy code would be appreciated, but the main question for this post is:
How can I contain everything in the wrapper properly and have the entire site centered, including the sidebar, in all browsers (especially Firefox) like how it appears in Chrome? (Additionally, some of the layout was done accidentally, like the Comment & TopNav buttons appearing slightly off the previous area. Which I want to keep, but I'm not sure how to properly keep it that way.)
I searched thoroughly and the answers provided keep telling me the appropriate CSS to use, and I keep using it to no avail. Other questions are simply left unanswered.
Any help would be appreciated!
The problem is coming from the way you used transform-origin for firefox browser. Look at the following class
html {
zoom: .8;
-moz-transform: scale(0.8);
-moz-transform-origin: 0 0;
margin: 20px auto;
}
As you mentioned "0 0" for origin property. The first value is the horizontal position, the second value is the vertical. So it aligned to left and top position. If you want horizontally center the page then you need to give "center, top" or "50%,0". Update your CSS like below.
html {
zoom: .8;
-moz-transform: scale(0.8);
-moz-transform-origin:50% 0;
margin: 20px auto;
}
Additional Question asked by OP in the comment box:
do you know why the sidebar is still condensed and overlapping the content on the left, when it doesn't do that in Chrome?
This issue came because the default behavior of chrome and firefox. Look at the following class.
.post {
width: 70%;
background-color:rgba(0,0,0,0.9);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 30px;
margin-left: 5px;
}
The default chrome property for box-sizing:border-box and firefox is box-sizing:content-box. This is causing the problem. Check what is the difference between these to here
So force firefox to use border-box property for box-sizing. Update the CSS like below.
.post {
width: 70%;
background-color:rgba(0,0,0,0.9);
border-radius: 20px;
box-shadow: 5px 0px 4px 0px #1c6191;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 30px;
margin-left: 5px;
-moz-box-sizing:border-box;
}
The site looks in Chrome exactly as it looks in Firefox. Because of this here:
margin-right: 0 auto;
which is an invalid property for margin-right. You want
margin: 0 auto;

How do I get wp_nav_menu to stay expanded when I navigate to submenu items?

I am a new arrival in the Wordpress community and currently I am working on trying to convert a static HTML site over to the WP platform. I have almost everything in my theme working with one exception: the navigation menu.
I am trying to use the built in navigation functionality, and I am pretty sure I have seen this done on other WP sites, but I'm having a hard time finding help to guide me through this area (I apologize if there is already an ask for this scenario on stackoverflow, I've been searching for a few days now and maybe I'm just using the wrong terminology?).
This is my testing base: http://ahathaway.n120.fiercethought.net/consumer-support/
That link will take you to the only section on the website that is supposed to have a "sub-menu" and what I am trying to accomplish is having the submenu stay expanded if and when the user navigates to any of the sub-menu items (i.e. if you click "Membership Forms" the sub-menu shouldn't disappear as it does currently).
I'm not sure what I'm missing here exactly, and I'm in desperate need of a nudge in the correct direction, so any help at all is and will be much appreciated! Thanks!
Here is my relevant code (please let me know if you need/want to see anything else, I tried to keep this post concise, at least initially):
From header.php:
<!-- Begin navigation menu -->
<?php
// Top navigation menu
wp_nav_menu( array(
'theme_location' => 'top-navigation',
'menu_id' => 'nav',
'menu_class' => 'left',
'depth' => 2,
'walker' => new Walker_Nav_Menu));
?>
<!-- End navigation menu -->
Here is the style.css (since this is a conversion and needs to look as close to identical as possible, much of the CSS has been left intact:
/* The following is from the reset.css originally housed */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
body {
line-height: 1;
color: black;
background: white;
}
ol, ul {
list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
text-align: left;
font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}
/* The following CSS came from screen.css from the original website */
body {background: #3279b3; color: #333; font: 13px/17px "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;}
strong {font-weight: bold;}
p {margin: 10px 0;}
p.small {font-size: 11px; line-height: 14px; color: #666;}
label {font-weight: bold;}
input, textarea {margin: 5px 0 10px 0; font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;}
textarea {width: 500px; height: 100px; font-size: 11px; padding: 5px;}
a {color: #738403; font-weight: bold;}
hr {margin: 20px 5px; border: none; border-bottom: 1px solid #bed6e9; clear: left;}
* + html hr{margin: 10px 5px 0 5px; padding: 0; border: none !important; line-height: 1px; color: #bed6e9;}
#wrapper {width: 100%; margin: 0 auto; background: url(/_assets/bg_body.png) top center repeat-y;}
#cols {width: 930px; margin: 0 auto; background: url(/_assets/bg_cols.png) 0 0 no-repeat; position: relative; overflow: auto; padding: 0 15px 10px 15px;}
#cols img.bnr {float: left; margin-bottom: 18px}
#topbar {height: 50px; width: 708px; position: absolute; top: 0; right: 14px;}
#topbar form {float: right; margin-top: 11px; background: url(/_assets/bg_search.png) 0 0 no-repeat; width: 175px; height: 28px;}
#topbar input {background: none; border: none; margin: 0;}
#topbar input.box {width: 130px; color: #c8e6ff; padding: 6px 0 6px 8px; font: 11px "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; height: auto; line-height: 11px; vertical-align: top;}
#topbar input.button {
width: 34px;
height: 26px;
font-size: 1px;
text-indent: -999em;
cursor: pointer;
}
#weather {float: left; margin-top: 4px; font-size: 12px;}
#weather ul, #weather li {display: inline; line-height: 40px; color: #fff;}
#weather img {float: left; margin-right: 3px;}
#col_lft {width: 215px; float: left; background: url(/_assets/bg_nav.png) bottom center no-repeat;}
#nav {width: 215px;}
#nav li a, menu-item {color: #fff; font-size: 13px; text-decoration: none; height: 35px; line-height: 37px; width: 185px; padding: 0 15px; display: block; border-top: 1px solid #416788; border-bottom: 1px solid #17354e; font-weight: normal;}
#nav li a:hover, #nav li.current_page_item a, #nav li.parent-here a {color: #76d3ff; background: url(/_assets/bg_nav_hover.png) top center no-repeat; border-top: 1px solid #17354e;}
#nav li ul {display: none; margin: 0; padding: 0;}
#nav li ul li a {border: 0 !important;}
#nav li.current_page_item ul, #nav li.parent-here ul {display: inline !important;}
#nav li.current_page_item ul li a, #nav li.parent-here ul li a { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;}
#nav li ul li a:hover, #nav li ul li a:active, #nav li.parent-here ul li.current_page_item a { background-image: none !important; color: #259fd2; }
#nav li.last a, #nav li ul li.last a, #nav li ul li.herelast a {padding-bottom: 3px; border-bottom: none !important;}
#nav li ul li.last a {padding-bottom: 12px;}
#nav li.herelast a {background: url(/_assets/bg_nav_hover_bot.png) bottom center no-repeat; border: none !important; padding-top: 1px; padding-bottom: 3px;}
#nav li.last a:hover {background: url(/_assets/bg_nav_hover_bot.png) bottom center no-repeat;}
#nav li.herelast, #nav li.herelast a {color: #259fd2 !important;}
* + html #nav li ul {float: left; margin-left: -16px;}
#col_rht {width: 700px; float: right; margin-top: 65px;}
#col_rht h1 {font-size: 24px; font-weight: bold; color: #d87500; margin: 6px 5px 15px 5px; padding-bottom: 22px; line-height: 24px; border-bottom: 1px solid #88abc7;}
#col_rht h2 {font-size: 15px; line-height: 18px; font-weight: bold; margin: 20px 5px 10px 5px;}
#col_rht h3 {font-weight: bold; margin-top: 20px;}
#col_rht h3, #col_rht p, #col_rht ul, #col_rht ol, #col_rht table, #col_rht blockquote {margin: 10px 5px;}
#col_rht table {width: 690px;}
#col_rht table, td {border: 1px solid #b9d7ef; border-collapse: collapse;}
#col_rht td {padding: 6px 8px; line-height: 15px;}
#col_rht tr.odd {background: #dff1ff}
#col_rht ol li {
list-style: decimal;
margin-left: 20px;
margin-bottom: 5px;
}
#col_rht ul li {
list-style: disc;
margin-left: 20px;
margin-bottom: 5px;
}
#col_rht a {
color: #008ec9;
font-weight: bold;
}
#col_rht img.flt_lft {float: left; margin: 0px 15px 15px 5px;}
#col_rht img.flt_rht {float: right; margin: 5px 5px 15px 15px;}
#col_rht blockquote {background: #dff1ff; padding: 1px; border-left: 5px solid #82b0d4;}
#col_rht blockquote p {margin: 10px; padding: 0;}
#buckets {width: 700px; overflow: auto; background: url(/_assets/bg_buckets.png) 0 0 repeat-y; font-size: 12px;}
#buckets div.bucket {width: 202px; margin-right: 30px; float: left; padding: 0 5px; overflow:visible}
#buckets div.bucket.last {margin-right: 0; position:inherit}
#buckets h2 {font-size: 18px; font-weight: bold; color: #e07c06; margin: 0 0 12px 0; padding-bottom: 15px; line-height: 20px; border-bottom: 1px solid #bed6e9; line-height: 16px;}
#buckets h3 {font-weight: bold; margin: 10px 0;}
#buckets p {margin: 10px 0 0 0;}
#buckets label {margin-left: 10px;}
#buckets input {width: 195px;}
#buckets input.submit {margin-bottom: 0; width: 60px;}
#footer {width: 100%; height: 50px; margin: 0 auto; background: url(/_assets/bg_footer.png) bottom center no-repeat; padding-bottom: 40px;}
#footer p {margin: 0; padding: 15px 0 0 0; font-size: 11px; color: #666; line-height: 15px; text-align: center;}
there is a class called current_page_item which is responsible for the menu expansion. That class is present in li#menu-item-30 in the link you gave. However, current_page_item is absent and replaced by current_page_parent for the subpages. That's why it's not showing.
Therefore, what I recommend is that in your stylesheet, you duplicate every DOM identifier which uses current_page_item, and put current_page_parent in its place. Here is what I mean:
Before:
#nav li.current_page_item ul li a, #nav li.parent-here ul li a { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;}
After:
#nav li.current_page_parent ul li a, #nav li.current_page_item ul li a, #nav li.parent-here ul li a { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;}
Do that for every instance of current_page_item you find, and you should be good to go.
By the way, are you using Firebug or the Chrome/Safari Developer Tools? They are invaluable for debugging these types of problems. That's basically all I did. :)
I think you haven't mentioned any styling of the current class
current_page_item This is the class which keeps the menu open
In Css You can implement this styling:
#access {display: block; margin: 0 auto; width: 990px; z-index:999;}
#access .menu-header, div.menu {font-size: 13px; width:100%; float:left; height:42px; margin-top:10px; background:#F7F7F7;border:1px solid #e3e3e3; border-bottom:3px solid #e3e3e3;}
#access .menu-header ul, div.menu ul {list-style: none; margin: 0;}
#access .menu-header li, div.menu li {float: left; position: relative;padding-right:0px; z-index:9999;}
#access a {color: #fff; display: block; line-height: 35px; padding: 0 25px; text-decoration: none; font-size:14px;}
#access ul ul {display: none; position: absolute; top:42px; left:0px; float: left; width:170px; z-index: 999999999; background:#E3E3E3; padding:10px 6px 7px 10px;}
#access ul ul li {min-width:165px;}
#access ul ul ul {left: 100%; top: 0;}
#access ul ul a {line-height: 1em; padding:5px 10px; width:146px; height: auto; font-size:14px; text-transform:capitalize; margin-bottom:3px; background-color:#F7F7F7;}
.sub-menu li {background:none!important;}
/*.current_page_item > a{background-color:#BE100F; height:35px;}*/
.menu .sub-menu .current_page_item > a{background:none;}
.menu .current_page_item > a{background-color: #e3e3e3!important; color: #333 !important;}
.menu .current-menu-parent > a{background-color: #e3e3e3!important; color: #333 !important;}
#access ul ul :hover > a {background-color:#336699; color:#FFFFFF;}
#access ul li:hover > ul {display: block;}
In PHP:
<div id="access">
<?php
$args = array(
'theme_location' => 'header_menu',
'menu' => 'Main Menu',
'sort_column' => 'menu_order',
'container_class' => 'menu-header'
);
wp_nav_menu($args);
?>
</div>

Categories