Awkward gap between menu items. How to fix? - php

I am having trouble with the layout of a website I'm making.
I'm not very good with CSS.
So the trouble I'm having is that I want to have a horizontal menu bar that I want to center in my website. This menu can have dropdown children.
The implementation is in jQuery.
So this is the HTML code of my menu bar :
<ul class='dropdown'>
<li><a href='index.php'>Home</a></li>
<li><a href='#'>Incident</a>
<ul class='sub_menu'>
<li><a href='index.php?action=new'>New</a></li>
<li><a href='index.php?action=edit'>Edit</a></li>
<li><a href='index.php?action=manage'>Manage</a></li>
</ul>
</li>
<li><a href='action_logout.php'>Log out</a></li>
</ul>
and this is the CSS that is being implemented :
* { margin: 0; padding: 0; }
body { font: 14px Helvetica, Sans-Serif; margin: 15px; }
a { text-decoration: none; }
ul { width: 800px; list-style: none; text-align: center; margin: auto; padding: 2px 2px;}
p { margin: 15px 0; }
/*
LEVEL ONE
*/
ul.dropdown { position: relative; }
ul.dropdown li { display: inline; font-weight: bold; background: #ccc; padding: 2px 2px; border-bottom: 1px solid #777; }
ul.dropdown a:hover { color: #000; }
ul.dropdown a:active { color: #ffa500; }
ul.dropdown li a { display: inline; padding: 2px 8px; border-right: 1px solid #777; border-bottom: 1px solid #777;
color: #222; }
ul.dropdown li:last-child a { border-right: none; } /* Doesn't work in IE */
ul.dropdown li.hover,
ul.dropdown li:hover { background: #F3D673; color: black; position: relative; }
ul.dropdown li.hover a { color: black; }
/*
LEVEL TWO
*/
ul.dropdown ul { width: 175px; visibility: hidden; position: absolute; top: 100%; left: 0; text-align: left; }
ul.dropdown ul li { font-weight: normal; background: #f6f6f6; color: #000;
border-bottom: 1px solid #ccc; float: none; }
/* IE 6 & 7 Needs Inline Block */
ul.dropdown ul li a { border-right: none; width: 100%; display: inline-block; }
An Example can be seen here.
I did manage to center my menu bar after all. However there seems to be a little gap between Home and Incident menus and I've no idea how to get rid of it.
Any ideas?
Thank you in advance.

Somehow you managed to put whitespace outside <li> element, here is absolutely same code with whitespace removed:
http://jsfiddle.net/fPAFs/1/

How about this: http://dabblet.com/gist/2520870
Your code was a mess.
<style>
* {
padding: 0;
margin: 0;
}
body {
font-family: helvetica, serif;
font-size: 14px;
}
ul {
list-style-type: none;
}
.dropdown {
text-align: center;
font-size: 0;
margin: 15px;
}
ul.dropdown ul {
width: 220px;
visibility: hidden;
position: absolute;
top: 1.8em;
left: 0;
}
ul.dropdown ul li a {
font-weight: normal;
background: #f6f6f6;
color: #000;
border-bottom: 1px solid #ccc;
float: none;
}
.dropdown > li {
display: inline-block;
height: 1.2em;
font-size: 14px;
position: relative;
}
.dropdown li a {
display: block;
background: rgb(204, 204, 204);
border-bottom: rgb(119, 119, 119) 1px solid;
border-right: rgb(119, 119, 119) 1px solid;
padding: 0.3em;
color: rgb(0, 0, 0);
text-decoration: none;
font-weight: bold;
}
.dropdown li a:hover {
background: rgb(243, 214, 115);
}
</style>
<ul class='dropdown'>
<li><a href='index.php'>Home</a></li>
<li><a href='#'>Incident</a>
<ul class='sub_menu'>
<li><a href='index.php?action=new'>New</a></li>
<li><a href='index.php?action=edit'>Edit</a></li>
<li><a href='index.php?action=manage'>Manage</a></li>
</ul>
</li>
<li><a href='action_logout.php'>Log out</a></li>
</ul>
Try this new code. Though I urge you to not try and implement someone else's code without understanding it first!

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 apply css to codeigniter pagination?

Here, is my pagination view like in blow image :
But, I want my pagination like below :
Here, Is my html stucture :
<div class="pagination">
<span class="label-pagination">Showing 1 to10 of 1147 entries </span>
<b>1</b>
2
3
›
»
</div>
css is :
.pagination {
width: 100%;
display: inline-block;
}
.pagination a{
border: 1px solid #FFFFFF;
transition: background-color .3s;
float: right;
text-decoration: none;
padding: 8px 16px;
color: #fff;
}
.page-display {
float: right;
}
.pagination b {
border: 1px solid #FFFFFF;
transition: background-color .3s;
float: right;
text-decoration: none;
padding: 8px 16px;
color: #fff;
background: #999999;
}
.pagination > a:first-child {
border-bottom-left-radius: 6px;
border-top-left-radius: 6px;
}
.pagination > a:last-child {
border-bottom-right-radius: 6px;
border-top-right-radius: 6px;
}
.pagination .label-pagination {
float: left;
}
.pagination a:hover {
background: #999999;
}
Also I want my first and last pagination in border-radius, How do I do that?
You can do it like this.
Hope it will helps you.
.page-display {
float: right;
}
.pagination b {
border: 1px solid #999999;
transition: background-color .3s;
text-decoration: none;
padding: 8px 16px;
color: #fff;
background: #999999;
float: left;
}
.pagination a:first-child {
border-bottom-left-radius: 6px;
border-top-left-radius: 6px;
}
.pagination a:last-child {
border-bottom-right-radius: 6px;
border-top-right-radius: 6px;
}
.pagination .label-pagination {
float: left;
}
.pagination a:hover {
background: #999999;
}
.pagination {
display: inline-block;
width: 100%;
}
.pagination a {
color: black;
float: left;
padding: 8px 16px;
text-decoration: none;
transition: background-color .3s;
border: 1px solid #ddd;
}
.pagination a.active {
background-color: #4CAF50;
color: white;
border: 1px solid #4CAF50;
}
.pagination a:hover:not(.active) {background-color: #ddd;}
.pagination-btns {
float: right;
}
<div class="pagination">
<span class="label-pagination">Showing 1 to10 of 1147 entries </span>
<span class="pagination-btns">
<b>1</b>
2
3
›
»
</span>
</div>

Menu bar flicker when goes to different page

Can anyone suggest what might be the problem on my flickering menu bar?
Please suggest anything that will make the flickering of menu bar stop.
Thanks much!
#mainmenu{
margin-bottom: 2.5em;
}
.menubar{
position: fixed;
top:0;
left:0;
max-height:10em;
width:100%;
list-style: none;
background-color:#333333;
text-align: left;
margin:0;
padding: 0;
z-index: 1;
border-bottom: 1px solid #ccc;
}
.menubar .first {
margin-left: 1em;
}
.menubar li{
position: relative;
display: inline-block;
width:15em;
text-align: center;
font-family: 'Oswald', sans-serif;
font-size: 1em;
border-bottom: none;
cursor: pointer;
}
.menubar li:hover{
background-color:#6666ff;
}
.menubar a{
display: block;
padding: 0.5em 0.5em 0.5em 0.5em;
text-decoration: none;
color:#ffffff;
}
/* for submenus */
.menubar .first .submenubar {
padding: 0;
position: absolute;
top:2em;
left:0;
width:auto;
display: none;
-webkit-box-shadow: 0px 13px 25px rgba(0,0,0, 0.2);
-moz-box-shadow: 0px 13px 25px rgba(0,0,0, 0.2);
box-shadow: 0px 13px 25px rgba(0,0,0, 0.2);
}
.menubar li .submenubar li {
text-align: left;
list-style-type: none;
background-color:brown;
display: block;
color:#fff;
}
.menubar > li > .submenubar > li:hover {
background-color:black;
}
.menubar li:hover .submenubar{
display: block;
}
See this JsFiddle for my complete code.
I suspect that one of 2 things are happening.
Is the whole header "flickering" when you go to a new page? If so,
that's because you are building an html page from your php on the
server and then rendering the page again. Sometimes this will flash.
Sucks.
The sub-menu appears to "flicker" because it's broken and when you
try and hove over it, it disappears.
If it's 1, you can use caching to try and lessen the chances of this happening, or you can learn how to use ajax, or a js framework to build single page apps, but that's a lot of work.
If it's 2, then this code I'll include below, and this fiddle - will set you up with some more solid code to work with.
My real advice, is to just never use drop-down menus. They are a terrible interface pattern.
HTML
<nav class='container navigation'>
<div class='inner-w'>
<ul class='menu'>
<li>
<a href='#'>Top-level menu item 1</a>
<ul class='sub-menu'>
<li><a href='#'>Sub-menu item 1</a></li>
<li><a href='#'>Sub-menu item 2</a></li>
<li><a href='#'>Sub-menu item 3</a></li>
<li><a href='#'>Sub-menu item 4</a></li>
</ul>
</li>
<li><a href='#'>Top-level menu item 2</a></li>
<li>
<a href='#'>Top-level menu item 3</a>
<ul class='sub-menu'>
<li><a href='#'>Sub-menu item 1</a></li>
<li><a href='#'>Sub-menu item 2</a></li>
</ul>
</li>
<li><a href='#'>Top-level menu item 4</a></li>
</ul>
</div>
</nav>
CSS
/* global-structure */
.container {
width: 100%;
float: left;
}
.container .inner-w {
margin-right: auto; margin-left: auto;
max-width: 900px; /* arbitrary */
/* this should have a clear-fix */
}
/* menu styles */
.menu, .menu ul {
list-style: none;
margin: 0;
padding: 0;
}
.menu li {
float: left;
}
.menu > li { /* just the top-level li */
position: relative;
/* so the sub-menu can be positioned to this */
border-right: 1px solid rgba(0,0,0,.3)
}
.menu > li:last-child {
border-right: 0;
}
.menu a {
display: block;
padding: .8rem .5rem;
background: #eee;
min-width: 160px;
color: inherit;
text-decoration: none;
}
.sub-menu {
position: absolute;
top: 100%;
left: 0;
height: 0;
width: 0; /* just hide it visually */
overflow: hidden;
z-index: 5; /* arbitrary, keep them small though... */
}
.sub-menu li {
clear: left;
border-bottom: 1px solid rgba(0,0,0,.3)
}
.sub-menu li:last-child {
border-bottom: 0;
}
.sub-menu a {
background: #ccc;
}
.sub-menu a:hover {
background: #aaa;
}
.menu > li:hover .sub-menu {
height: auto;
width: auto;
}
If I was absolutely forced to write a drop-down menu, It would have to be like this: http://codepen.io/sheriffderek/pen/qdBryb/?editors=010

Avada Theme - Submenu customization

I just started using the Avada Theme in my wordpress site. I need to customize the menu on the left hand side. The items in the submenu should be shown below the parent item, not on next to it. I started by using the side-navigation css styles, but I can't get the child items to work.
.side-nav {
list-style: none;
margin: 0;
padding: 0;
border-top: 1px solid #ededed;
margin-bottom: 20px;
}
.side-nav ul {
list-style: none;
margin: 0;
padding: 0;
}
.side-nav li {
margin: 0;
padding: 0;
}
.side-nav li a {
border-bottom: 1px solid #ededed;
display: block;
height: auto;
font-weight: normal;
font: 14px/39px 'MuseoSlab500Regular', arial, helvetica, sans-serif;
color: #333333;
}
.side-nav li a {
line-height: 1.69em;
padding: 8px 0;
}
.side-nav li a:hover {
background: none;
}
.side-nav li.current_page_item > a {
background: none;
color: #a0ce4e;
}
.side-nav li.current_page_item li a {
color: #333333;
border-bottom: 1px solid #ededed;
}
.side-nav .children {
display: none;
margin-left: 15px;
}
.side-nav .arrow {
display: inline;
margin-left: 0;
}
.side-nav .arrow:after {
position: absolute;
font-size: 14px;
font-family: IcoMoon;
}
.side-nav-left .side-nav {
border-right: 1px solid #ededed;
}
.side-nav-left .side-nav li.current_page_item > a {
border-right: 3px solid #a0ce4e;
}
.side-nav-left .side-nav .arrow {
margin-left: 10px;
}
.side-nav-left .side-nav .arrow:after {
content: '\f105';
}
.side-nav-right .side-nav {
border-left: 1px solid #ededed;
}
.side-nav-right .side-nav li.current_page_item > a {
padding-left: 23px;
border-left: 3px solid #a0ce4e;
}
.side-nav-right .side-nav li a {
padding-left: 25px;
}
.side-nav-right .side-nav .arrow {
margin-right: 10px;
}
.side-nav-right .side-nav .arrow:after {
content: '\f104';
}
.side-nav-right .side-nav .children {
margin-left: 40px;
}
.side-nav-right .side-nav .children a {
padding-left: 0;
}
For better understanding here is a screenshot of what I try to build.
The Image on the left shows the current style of the menu / submenu. The image on the right is showing the side-navigation template which comes with Avada. Out of the Box it's not possible to use the side-navigation style in the main menu. I already posted a question in the Theme-Fursion forum, but they were not able to help me. Maybe you can give me a hint.
Thank you
To achieve this effect you would have to change the positioning of the submenu list from absolute to relative, and adjust it a bit e.g. in this way:
body.side-header-left #side-header #nav > ul > li > ul.sub-menu {
position: relative;
right: auto;
left: auto;
top: auto;
visibility: visible;
opacity: 1;
width: 100%;
height: 0;
overflow:hidden;
}
body.side-header-left #side-header #nav > ul > li:hover > ul.sub-menu,
body.side-header-left #side-header #nav > ul > li.current_page_item > ul.sub-menu {
height: auto;
}

My link is not working well using jquery

I have a link like this
<li><a class='myclass' href="<?php echo base_url();?>index.php/controller">Search</a></li>
and my jquery is
$("a.myclass").click(function(){
var link = $(this);
var url = link.attr("href");
$(".content").load(url);
return false;
});
actually it links correctly the problem is my list in my menu looks ugly not it looks it should be though other li looks ok. when i change to
<li><a class='.myclass.' href="<?php echo base_url();?>index.php/controller">Search</a></li>
it looks correctly but its not linking to anything.
What is the problem here?
Here is my css
.webwidget_vertical_menu {
float: left;
width: 20%;
background-color: #fff;
padding-bottom: 10px;
}
.webwidget_vertical_menu ul{
padding: 0.5px;
margin: 0px;
font-family: Arial, Helvetica, sans-serif;
}
.webwidget_vertical_menu li{
}
.webwidget_vertical_menu ul li{
list-style: none;
position: relative;
}
.webwidget_vertical_menu ul li a{
padding-left: 15px;
text-decoration: none;
}
.webwidget_vertical_menu ul li ul{
display: none;
position: absolute;
background-color: #fff;
z-index: 999999;
}
.webwidget_vertical_menu ul li ul li{
position: relative;
margin: 0px;
border:none;
}
.webwidget_vertical_menu ul li ul li ul{
}
.webwidget_vertical_menu_down_drop{
background-position: right center;
background-repeat:no-repeat !important;
}
.webwidget_vertical_menu ul li li{
font-weight: normal;
}
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background-color: #42413C;
margin: 0;
padding: 0;
color: #000;
}
ul, ol, dl {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
padding-right: 15px;
padding-left: 15px;
}
a img {
border: none;
}
a:link {
color:#414958;
text-decoration: underline;
}
a:visited {
color: #4E5869;
text-decoration: underline;
}
a:hover, a:active, a:focus {
text-decoration: none;
}
.container {
width: 80%;
max-width: 1260px;
background: #FFF;
margin: 0 auto;
}
.header {
background-color: #ADB96E;
}
.sidebar1 {
float: left;
width: 20%;
background-color: #EADCAE;
padding-bottom: 10px;
}
.content {
padding: 10px 0;
width: 60%;
float: left;
}
.sidebar2 {
float: right;
width: 20%;
background-color: #EADCAE;
padding: 10px 0;
}
.content ul, .content ol {
padding: 0 15px 15px 40px; }
ul.nav {
list-style: none;
border-top: 1px solid #666;
margin-bottom: 15px;
}
ul.nav li {
border-bottom: 1px solid #666;
list-style: none;
position:relative;
}
ul.nav a, ul.nav a:visited {
padding: 5px 5px 5px 15px;
display: block;
text-decoration: none;
background-color: #C6D580;
color: #000;
}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus {
background: #ADB96E;
color: #FFF;
}
/* ~~The footer ~~ */
.footer {
padding: 10px 0;
background: #CCC49F;
position: relative;
clear: both;
}
/* ~~miscellaneous float/clear classes~~ */
.fltrt {
float: right;
margin-left: 8px;
}
.fltlft {
float: left;
margin-right: 8px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
.menu {
color: #414141;
font-size:16px;
font-weight:650;
text-align: center;
}
You don't need the dot (.) in class name.
Try this:
<li><a class='myclass' href="<?php echo base_url();?>index.php/controller">Search</a></li>
And jquery...
// This means select the `<a>` element with class `myclass`.
// Dot (.) means class selector.
$("a.myclass").click(function(){
var link = $(this);
var url = link.attr("href");
$(".content").load(url);
return false;
});
Well, I need more conditions to answer exactly, but I guess there are some css styles for myclass. Try to rename myclass to something like f-ajax-link-selector (don't forget to change it in JS) and try to refresh the page.

Categories