I'm having problem in implementing the footer for my website.
I have taken two <ul> lists in the inner_footer as you can see in the code below. But as I zoom in, the <ul> list in the div element is not visible. It seems a float problem, but I'm not able to figure out what's wrong with it.
HTML:
<div class="grid_16">
<div class="footer">
<div class="inner_footer">
<ul>
<li>Some content</li>
</ul>
<div>
<ul>
<li><a>Link 1</a></li>
<li><a>Link 2</a></li>
<li><a>Link 3</a></li>
<li><a>Link 4</a></li>
<li><a>Link 5</a></li>
<li>Copyrights</li>
</ul>
</div>
</div>
</div>
CSS:
.footer {
height:105px;
position:relative;
top:0;
width:100%;
}
.inner_footer {
background:url(../images/layout_img/nav.jpg) 0 center repeat-x;
font-size:12px;
border-radius:4px;
position:relative;
width:inherit;
height:31px;
margin:0 auto;
}
.inner_footer ul {
margin:0;
}
.inner_footer ul li {
color:#FFF;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
.inner_footer ul li a img {
margin:2px 0 0 20px;
}
.inner_footer ul li a {
color:#FFF;
float:left;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
.inner_footer div {
float:right;
}
.inner_footer div ul li a {
color:#FFF;
float:left;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
.inner_footer div ul li {
color:#FFF;
float:left;
font-family:calibri;
font-size:13px;
list-style-type:none;
line-height:31px;
text-decoration:none;
padding:0 10px;
}
I believe the problem is in your html code. You forgot to close a div element. The code should become:
<div class="grid_16">
<div class="footer">
<div class="inner_footer">
<ul>
<li>Some content</li>
</ul>
</div>
<div>
<ul>
<li><a>Link 1</a></li>
<li><a>Link 2</a></li>
<li><a>Link 3</a></li>
<li><a>Link 4</a></li>
<li><a>Link 5</a></li>
<li>Copyrights</li>
</ul>
</div>
</div>
</div>
Related
Please help me to create sub menu of the below design. sub menu should be align into just below the list.i my design menu and sub menu seems the same.
CSS:
#vertmenu {
font-family:'Trebuchet MS';
font-size:14px;
width:250px;
margin:0 0 0 20px;
padding:0;
}
#vertmenu h1 {
display:block;
font-size:14px;
color:gray;
width:159px;
margin:0;
padding:3px 0 5px 3px;
}
#vertmenu ul {
list-style:none;
border:none;
margin:0;
padding:0;
}
#vertmenu ul li {
margin:0;
padding:0;
}
#vertmenu ul li a {
font-size:14px;
display:block;
border-bottom:1px dashed #C39C4E;
text-decoration:none;
color:#666;
width:160px;
padding:5px 0 2px 4px;
}
#vertmenu ul li a:hover,#vertmenu ul li a:focus {
color:#000;
background-color:#eee;
}
HTML Code:
<div id="vertmenu">
<h1>How to sell your images</h1>
<ul>
<li>Home
<ul>
<li>Sub Menu 1</li>
<li>Sub Menu 2</li>
</ul>
</li>
<li>About Us</li>
<li>Computing</li>
<li>Web Sites</li>
<li>Games</li>
<li>Links</li>
</ul>
</div>
and sub menu visible by default not on the click of menu.
I have tried but it is not working .
help is really appreciated.
#vertmenu {
font-family:'Trebuchet MS';
font-size:14px;
width:250px;
margin:0 0 0 20px;
padding:0;
}
#vertmenu h1 {
display:block;
font-size:14px;
color:gray;
width:159px;
margin:0;
padding:3px 0 5px 3px;
}
#vertmenu>ul {
list-style:none;
border:none;
margin:0;
padding:0;
}
#sub{
list-style: none;
}
#vertmenu ul li {
margin:0;
padding:0;
}
#vertmenu ul li a {
font-size:14px;
display:block;
border-bottom:1px dashed #C39C4E;
text-decoration:none;
color:#666;
width:160px;
padding:5px 0 2px 4px;
}
#vertmenu ul li a:hover,#vertmenu ul li a:focus {
color:#000;
background-color:#eee;
}
HTML Code:
<div id="vertmenu">
<h1>How to sell your images</h1>
<ul>
<li>Home
<ul id="sub">
<li>Sub Menu 1</li>
<li>Sub Menu 2</li>
</ul>
</li>
<li>About Us</li>
<li>Computing</li>
<li>Web Sites</li>
<li>Games</li>
<li>Links</li>
</ul>
</div>
Do you mean something like this?
Fiddle
<div id="vertmenu">
<h1>How to sell your images</h1>
<ul>
<li>Home
<ul class="children">
<li>Sub Menu 1</li>
<li>Sub Menu 2</li>
</ul>
</li>
<li>About Us</li>
<li>Computing</li>
<li>Web Sites</li>
<li>Games</li>
<li>Links</li>
</ul>
</div>
#vertmenu {
font-family:'Trebuchet MS';
font-size:14px;
width:250px;
margin:0 0 0 20px;
padding:0;
}
#vertmenu h1 {
display:block;
font-size:14px;
color:gray;
width:159px;
margin:0;
padding:3px 0 5px 3px;
}
#vertmenu ul {
list-style:none;
border:none;
margin:0;
padding:0;
}
#vertmenu ul li {
margin:0;
padding:0;
}
#vertmenu ul li a {
font-size:14px;
display:block;
border-bottom:1px dashed #C39C4E;
text-decoration:none;
color:#666;
width:160px;
padding:5px 0 2px 4px;
}
#vertmenu ul li a:hover,#vertmenu ul li a:focus {
color:#000;
background-color:#eee;
}
li:hover > .children {
display:block;
}
.children {
display:none;
}
Notice the added children class on ul and the hover event.
We were following this tutorial (http://www.script-tutorials.com/click-action-multilevel-css3-dropdown-menu/). The goal was to create a multilevel dropdown click menu with css/html and no js. The code works fine in firefox and even works in the demo shown in the tutorial in chrome, but downloading the code and using it separately doesn't work in chrome. Anyone have any ideas why? The code for the menu is:
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
<div class="example">
<ul id="nav">
<li>Home</li>
<li><a class="fly" href="#">Tutorials</a>
<ul class="dd">
<li>HTML / CSS</li>
<li><a class="fly" href="#">JS / jQuery</a>
<ul>
<li>jQuery</li>
<li>JS</li>
</ul>
</li>
<li>PHP</li>
<li>MySQL</li>
<li>XSLT</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#">Resources</a>
<ul class="dd">
<li><a class="fly" href="#">By category</a>
<ul>
<li>PHP</li>
<li>MySQL</li>
<li><a class="fly" href="#">Menu1</a>
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li><a class="fly" href="#">Menu3</a>
<ul>
<li>Menu31</li>
<li>Menu32</li>
<li>Menu33</li>
<li>Menu34</li>
</ul>
</li>
<li>Menu4</li>
</ul>
</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#">By tag name</a>
<ul>
<li>captcha</li>
<li>gallery</li>
<li>animation</li>
</ul>
</li>
</ul>
</li>
<li>About</li>
<li>Go Back To The Tutorial</li>
</ul>
</div>
/* demo page styles */
body {
background:#eee;
margin:0;
padding:0;
}
.example {
background:#fff url(../images/tech.jpg);
width:770px;
height:570px;
border:1px #000 solid;
margin:20px auto;
padding:15px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
}
/* main menu styles */
#nav,#nav ul {
background-image:url(../images/tr75.png);
list-style:none;
margin:0;
padding:0;
}
#nav {
height:41px;
padding-left:5px;
padding-top:5px;
position:relative;
z-index:2;
}
#nav ul {
left:-9999px;
position:absolute;
top:37px;
width:auto;
}
#nav ul ul {
left:-9999px;
position:absolute;
top:0;
width:auto;
}
#nav li {
float:left;
margin-right:5px;
position:relative;
}
#nav li a {
background:#c1c1bf;
color:#000;
display:block;
float:left;
font-size:16px;
padding:8px 10px;
text-decoration:none;
}
#nav > li > a {
-moz-border-radius:6px;
-webkit-border-radius:6px;
-o-border-radius:6px;
border-radius:6px;
overflow:hidden;
}
#nav li a.fly {
background:#c1c1bf url(../images/arrow.gif) no-repeat right center;
padding-right:15px;
}
#nav ul li {
margin:0;
}
#nav ul li a {
width:120px;
}
#nav ul li a.fly {
padding-right:10px;
}
/*hover styles*/
#nav li:hover > a {
background-color:#858180;
color:#fff;
}
/*focus styles*/
#nav li a:focus {
outline-width:0;
}
/*popups*/
#nav li a:active + ul.dd,#nav li a:focus + ul.dd,#nav li ul.dd:hover {
left:0;
}
#nav ul.dd li a:active + ul,#nav ul.dd li a:focus + ul,#nav ul.dd li ul:hover {
left:140px;
}
New css Worked for me in both crome and firefox!::::
body {
background:#eee;
margin:0;
padding:0;
}
.example {
background:#fff url(../images/tech.jpg);
width:770px;
height:570px;
border:1px #000 solid;
margin:20px auto;
padding:15px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
}
/* main menu styles */
#nav,#nav ul {
background-image:url(../images/tr75.png);
list-style:none;
margin:0;
padding:0;
}
#nav {
height:41px;
padding-left:5px;
padding-top:5px;
position:relative;
z-index:2;
}
#nav ul {
left:-9999px;
position:absolute;
top:37px;
width:auto;
}
#nav ul ul {
left:-9999px;
position:absolute;
top:0;
width:auto;
}
#nav li {
float:left;
margin-right:5px;
position:relative;
}
#nav li a {
background:#c1c1bf;
color:#000;
display:block;
float:left;
font-size:16px;
padding:8px 10px;
text-decoration:none;
}
#nav > li > a {
-moz-border-radius:6px;
-webkit-border-radius:6px;
-o-border-radius:6px;
border-radius:6px;
overflow:hidden;
}
#nav li a.fly {
background:#c1c1bf url(../images/arrow.gif) no-repeat right center;
padding-right:15px;
}
#nav ul li {
margin:0;
}
#nav ul li a {
width:120px;
}
#nav ul li a.fly {
padding-right:10px;
}
/*hover styles*/
#nav li:hover > a {
background-color:#858180;
color:#fff;
}
/*focus styles*/
#nav li a:focus {
outline-width:0;
}
/*popups*/
#nav li a:hover + ul.dd,#nav li a:focus + ul.dd,#nav li ul.dd:hover {
left:0;
}
#nav ul.dd li a:hover + ul,#nav ul.dd li a:focus + ul,#nav ul.dd li ul:hover {
left:140px;
}
In files for download is different html page. Difference is that live demo contain attribute tabindex="1" in some links. I downloaded source code from live example and it works in chrome now.
New code for your html page.
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
<div class="example">
<ul id="nav">
<li>Home</li>
<li><a class="fly" href="#" tabindex="1">Tutorials</a>
<ul class="dd">
<li>HTML / CSS</li>
<li><a class="fly" href="#" tabindex="1">JS / jQuery</a>
<ul>
<li>jQuery</li>
<li>JS</li>
</ul>
</li>
<li>PHP</li>
<li>MySQL</li>
<li>XSLT</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#" tabindex="1">Resources</a>
<ul class="dd">
<li><a class="fly" href="#" tabindex="1">By category</a>
<ul>
<li>PHP</li>
<li>MySQL</li>
<li><a class="fly" href="#" tabindex="1">Menu1</a>
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li><a class="fly" href="#" tabindex="1">Menu3</a>
<ul>
<li>Menu31</li>
<li>Menu32</li>
<li>Menu33</li>
<li>Menu34</li>
</ul>
</li>
<li>Menu4</li>
</ul>
</li>
<li>Ajax</li>
</ul>
</li>
<li><a class="fly" href="#" tabindex="1">By tag name</a>
<ul>
<li>captcha</li>
<li>gallery</li>
<li>animation</li>
</ul>
</li>
</ul>
</li>
<li>About</li>
<li>Go Back To The Tutorial</li>
</ul>
</div>
Here's the code. Notice that's NOT my code.
HTML:
<div class="drop">
<ul class="drop_menu">
<li><a href='#'>Link 1</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
</ul>
</li>
<li><a href='#'>Link 2</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
<li><a href='#'>Sub Link 3</a></li>
<li><a href='#'>Sub Link 4</a></li>
</ul>
</li>
<li><a href='#'>Link 3</a>
<ul>
<li><a href='#'>Sub Link 1</a></li>
<li><a href='#'>Sub Link 2</a></li>
<li><a href='#'>Sub Link 3</a></li>
<li><a href='#'>Sub Link 4</a></li>
</ul>
</li>
</ul>
</div>
CSS:
.drop_menu {
background:#005555;
padding:0;
margin:0;
list-style-type:none;
height:30px;
}
.drop_menu li { float:left; }
.drop_menu li a {
padding:9px 20px;
margin-left:auto;
margin-right:auto;
display:block;
color:#fff;
text-decoration:none;
font:12px arial, verdana, sans-serif;
}
/* Submenu */
.drop_menu ul {
position:absolute;
left:-9999px;
top:-9999px;
list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#5FD367; }
.drop_menu li:hover ul {
left:0px;
top:30px;
background:#5FD367;
padding:0px;
}
.drop_menu li:hover ul li a {
padding:5px;
display:block;
width:168px;
text-indent:15px;
background-color:#5FD367;
}
.drop_menu li:hover ul li a:hover { background:#005555; }
My question is, how can I center the "Link 1", "Link 2" and "Link 3"? On the future, I'll add more "Link 4,5,6...", so I need a solution that doesn't require "almost centered", but a permanent solution.
Can you please help me?
Here's a link to JSFiddle where you can see the code working - http://jsfiddle.net/W5F3p/
My best regards
If you're not supporting IE7 and below, I'd change the float:left on the li to a display:inline-block and then add text-align:center to the parent ul.
.drop_menu {
background:#005555;
padding:0;
margin:0;
list-style-type:none;
height:30px;
text-align:center;
}
.drop_menu li { display:inline-block; }
.drop_menu li a {
padding:9px 20px;
margin-left:auto;
margin-right:auto;
display:block;
color:#fff;
text-decoration:none;
font:12px arial, verdana, sans-serif;
}
/* Submenu */
.drop_menu ul {
position:absolute;
left:-9999px;
top:-9999px;
list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#5FD367; }
.drop_menu li:hover ul {
left:0px;
top:30px;
background:#5FD367;
padding:0px;
}
.drop_menu li:hover ul li a {
padding:5px;
display:block;
width:168px;
text-indent:15px;
background-color:#5FD367;
text-align:left;
}
.drop_menu li:hover ul li a:hover { background:#005555; }
See here: http://jsfiddle.net/s6Jcx/1/
Use text align in the container tag and set the list to display inline-block:
http://jsfiddle.net/W5F3p/1/
.drop
{
text-align: center;
background:#005555;
}
A little hacky but does the trick.
I hav created a horizontal menu and a vertical menu,in both cases I noticed that the elements are not rendered properly,the horizontal menu is too large:
<ul class="menu-horizontal">
<li>Home</li>
<li>About Us</li>
<li>Recent Articles</li>
<li>Email</li>
<li>Resources</li>
<li>Links</li>
</ul>
.menu-horizontal
{
background:blue;
width:926px;
height:30px;
overflow:hidden;
list-style: none;
}
.menu-horizontal li
{
display:inline-block;
text-align:center;
font-weight:bold;
padding:7px 45px;
color:white;
font-size:14px;
border-right:1px solid black;
}
I floated a list to the right,in this case I found that the vertical menu does not reach it's left border:
.menu-vertical
{
list-style:none;
float:right;
border:1px solid black;
width:200px;
height:auto;
margin-left:10px;
}
.menu-vertical li
{
padding-top:10px;
font-weight:4;
font-size:1.25em;
text-align: center;
text-decoration: underline;
color:blue;
background-color: #bfbbc9;
}
<ul class="menu-vertical group">
<li>Lorem</li>
<li>ipsum</li>
<li>dolor</li>
<li> sit amet</li>
<li> consectetur</li>
<li> adipiscing</li>
<li> elit</li>
</ul>
The entire HTML and CSS is at a fiddle.
Make sure to remove or override browser defaults, such as padding. E.g.
.menu-horizontal {padding: 0; margin: 0;}
I have to code the button below when its clicked it will display a dropdown menu.
How would I approach this as I have never come across this before.
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Geneva, sans-serif;
font-size: 100%;
color: #666;
}
body {
background-color: #fff;
margin-left: 20px;
margin-top: 20px;
margin-right: 20px;
margin-bottom: 20px;
}
a, a:hover, a:active, a:focus {
outline:0;
direction:ltr;
}
.wrapper {
position:relative; height:25px;
}
.mainmenu {
position:absolute;
z-index:100;
font-family:Verdana, Geneva, sans-serif;
font-weight:normal;
font-size:90%;
line-height:25px;
left:50%;
margin-left:-303px;
width:606px;
}
ul.menu {
padding:0;
margin:0;
list-style:none;
width:100px;
overflow:hidden;
float:left;
margin-right:1px;
}
ul.menu a {
text-decoration:none;
color:#fff;
padding-left:5px;
}
ul.menu li.list {
float:left;
width:250px;
margin:-32767px -125px 0px 0px;
background:url(images/top1.png) no-repeat left bottom;
}
ul.menu li.list a.category {
position:relative;
z-index:50;
display:block;
float:left;
width:120px;
margin-top:32767px;
background:transparent;
}
ul.menu li.list a.category:hover,
ul.menu li.list a.category:focus,
ul.menu li.list a.category:active {
margin-right:1px;
background-image:url(images/tophover1.png);
background-repeat:no-repeat;
background-position:left top;
}
ul.submenu {
float:left;
padding:25px 0px 0px 0px;
margin:0;
list-style:none;
background-image:url(images/tophover1.png);
background-repeat:no-repeat;
background-position:left top;
margin:-25px 0px 0px 0px;
}
ul.submenu li a {
float:left;
width:120px;
background:#369;
clear:left;
}
ul.submenu li a.endlist {
background:url(images/bottom1.png);
}
ul.submenu li a.endlist:hover,
ul.submenu li a.endlist:focus,
ul.submenu li a.endlist:active {
background:url(images/bottomhover1.png);
}
ul.submenu a:hover,
ul.submenu a:focus,
ul.submenu a:active {
background:#900;
margin-right:1px;
}
-->
</style>
<div class="wrapper">
<div class="mainmenu">
<ul class="menu">
<li class="list">
<a class="category" href="#Home">Home</a>
</li>
</ul>
<ul class="menu">
<li class="list">
<a class="category" href="#about">About Us »</a>
<ul class="submenu">
<li>About link 1</li>
<li>About link 2</li>
<li>About link 3</li>
<li>About link 4</li>
<li><a class="endlist" href="#about5">About link 5</a></li>
</ul>
</li>
</ul>
<ul class="menu">
<li class="list">
<a class="category" href="#articles">Articles »</a>
<ul class="submenu">
<li>Articles link 1</li>
<li>Articles link 2</li>
<li>Articles link 3</li>
<li><a class="endlist" href="#articles4">Articles link 4</a></li>
</ul>
</li>
</ul>
<ul class="menu">
<li class="list">
<a class="category" href="#news">News »</a>
<ul class="submenu">
<li>News link 1</li>
<li>News link 2</li>
<li><a class="endlist" href="#news3">News link 3</a></li>
</ul>
</li>
</ul>
<ul class="menu">
<li class="list">
<a class="category" href="#donate">Donate</a>
</li>
</ul>
<ul class="menu">
<li class="list">
<a class="category" href="#contact">Contact</a>
</li>
</ul>
<!-- end mainmenu --></div>
<!-- end wrapper --></div>
or try this link
http://www.texaswebdevelopers.com/blog/template_permalink.asp?id=129
or
http://www.1stwebdesigner.com/css/38-jquery-and-css-drop-down-multi-level-menu-solutions/
I agree with Jerome C.
The only seggestion I can give you, is that usually there are many sites whose title is "the best NNN dropdownmenus" or substitute dropdownmenus with whatever.
Thery are usually helpful.
In such case:
http://www.hongkiat.com/blog/drop-down-menu-30-free-scripts-to-enhance-header-navigation/