I'm designing a website for a non-profit and I'm having issues creating a navigation in the footer exactly like the one seen here.
I've accomplished the top part but the bottom part that looks like ULs next to each other is giving me trouble! I've been playing with the html/css for hours but nothing came close to this look so asking here is my last resort. I will post the current code.
**Not saying i'm a pro but I am not new to HTML/CSS as I created my entire website from scratch w/HTML & CSS.
Thanks in advance for your help!
HTML:
<div id="footer2" class="bottomleft bottomright">
<ul>
<li>ABOUT</li>
<li>
Our Mission and Vision
</li>
<li>
Our People
</li>
<li>
Our Outreach and Programs
</li>
<li>
Our Community Partners
</li>
</ul>
<ul>
<li>
ABOUT
</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<ul>
<li>ABOUT</li>
<li>
Our Mission and Vision
</li>
<li>
Our People
</li>
<li>
Our Outreach and Programs
</li>
<li>
Our Community Partners
</li>
</ul>
<ul>
<li>ABOUT</li>
<li>
Our Mission and Vision
</li>
<li>
Our People
</li>
<li>
Our Outreach and Programs
</li>
<li>
Our Community Partners
</li>
</ul>
</div>
<!--end footer2-->
<div id="footer3">
<br />Copyright © 2014 All rights reserved.
<br />
<br />RSCF is a nonprofit organization whose mission is to "empower an educational revolution throughout the South Los Angeles community and beyond..."
<br />
<br />
</div>
<!--end footer3-->
</div>
<!--end container-->
CSS
#footer2 {
background-color: #609;
width: 980px;
height: 200px;
clear: both;
display: block;
text-align: center;
color: #FFF;
font-size: small;
padding-top: 10px;
}
#footer2 ul {
text-align: left;
height: auto;
margin: 0px;
}
#footer2 ul li {
display:inline-table;
padding: 5px;
}
#footer2 ul li a {
text-decoration: none;
color: #FFF;
padding: 0px 8px 8px 8px;
}
#footer2 ul li a:hover {
text-decoration: underline;
font-weight:900;
}
The first thing that i did was remove the display: inline, i've replaced it with list-style none to reach the same visual effect like the site which you referred. Well, after that i've change all the ul's to float left, so each one will be rendered as you needed.
The new css:
#footer2 {
background-color: #609;
width: 980px;
height: 200px;
clear: both;
display: block;
text-align: center;
color: #FFF;
font-size: small;
padding-top: 10px;
}
#footer2 ul {
text-align: left;
height: auto;
margin: 0px;
float: left;
}
#footer2 ul li {
list-style: none;
padding: 5px;
}
#footer2 ul li a {
text-decoration: none;
color: #FFF;
padding: 0px 8px 8px 8px;
}
#footer2 ul li a:hover {
text-decoration: underline;
font-weight:900;
}
I created a fiddle to help you figure out the result: http://jsfiddle.net/5ms8up9w/
This is a little closer. I added a few divs and turned your id's into classes.
HTML
<div id="footer">
<div class="footer2 bottomleft bottomright">
<ul>
<li>ABOUT</li>
<li>Our Mission and Vision
</li>
<li>Our People
</li>
<li>Our Outreach and Programs
</li>
<li>Our Community Partners
</li>
</ul>
</div>
<div class="footer2">
<ul>
<li>ABOUT</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</div>
<div class="footer2">
<ul>
<li>ABOUT</li>
<li>Our Mission and Vision
</li>
<li>Our People
</li>
<li>Our Outreach and Programs
</li>
<li>Our Community Partners
</li>
</ul>
</div>
<div class="footer2">
<ul>
<li>ABOUT</li>
<li>Our Mission and Vision
</li>
<li>Our People
</li>
<li>Our Outreach and Programs
</li>
<li>Our Community Partners
</li>
</ul>
</div>
<!--end footer2-->
<div id="footer3">
<br />Copyright © 2014 All rights reserved.
<br />
<br />RSCF is a nonprofit organization whose mission is to "empower an educational revolution throughout the South Los Angeles community and beyond..."
<br />
<br />
</div>
<!--end footer3-->
</div>
<!--end container-->
CSS
#footer{width:100%;background-color:red;}
.footer2 {
background-color: #609;
width: 25%;
height: 200px;
float:left;
text-align: center;
color: #FFF;
font-size: small;
padding-top: 10px;
}
.footer2 ul {
text-align: left;
height: auto;
margin: 0px;
}
.footer2 ul li {
list-style:none;
padding: 5px;
}
.footer2 ul li a {
text-decoration: none;
color: #FFF;
padding: 0px 8px 8px 8px;
}
.footer2 ul li a:hover {
text-decoration: underline;
font-weight:900;
}
Fiddle: http://jsfiddle.net/383vdv3z/
Related
Ive created a box using div class. but Ive been trying to space the row and columnsiV
Ive tried some padding-left and right both it doesnt seem to be working.
<div class="body">
<ul class="box">
<li> Maths </li>
<li> English </li>
<li> Chemistry </li>
<li> Commerce </li>
<li> Computer </li>
<li> Biology </li>
</ul>
</div>
</section>
Is there a reason you aren't just using margin? Specifically,
li {
margin: 10px;
margin-left: 30px; // if you want a different margin on the left
}
If this is not what you're looking for then please elaborate on your question.
li {
margin:10px;
margin-left:30px;
}
<div class="body">
<ul class="box">
<li> Maths </li>
<li> English </li>
<li> Chemistry </li>
<li> Commerce </li>
<li> Computer </li>
<li> Biology </li>
</ul>
</div>
To add padding between the rows, you need to add it to list elements.
Target these by using ".box li" in your CSS
You can use this code
.body .box {
margin: 0;
padding: 0;
}
.body .box li {
margin: 0;
padding: 0;
list-style-type: none;
}
.body .box li a {
margin: 0;
padding: 0 15px;
font-size: 18px;
font-weight: 400;
color: #337ab7;
line-height: 36px;
text-decoration: none;
}
.body .box li:hover a {
color: red;
}
<div class="body">
<ul class="box">
<li>Maths</li>
<li>English</li>
<li>Chemistry</li>
<li> Commerce </li>
<li>Computer</li>
<li>Biology</li>
</ul>
</div>
I have 3 drop-down menus under nav, and I want to align them left, middle, and right. The left and right alignment are working using float, but I'm having difficulty to align a drop-down menu to the middle. Please see the css selector
.inline-menu.middle-menu at https://jsfiddle.net/xv51vkc7/.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Title</title>
<link rel="stylesheet" type="text/css" href="css/theme_1.css">
</head>
<body>
<nav>
<ul class="inline-menu left-menu">
<li>Left-A
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
<li>Left-B
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
<ul class="inline-menu middle-menu">
<li>Middle-A
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
<li>Middle-B
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
<ul class="inline-menu right-menu">
<li>Right-A
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
<li>Right-B
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
body{
background-color: #eee;
padding: 0;
}
.inline-menu,
.inline-menu ul{
list-style: none;
padding: 0;
margin: 0;
}
.inline-menu > li{
display: inline-block;
padding-right: 25px;
background-color: yellow;
position: relative;
}
.inline-menu a{
text-decoration: none;
}
.inline-menu > li > ul{
display: none;
position: absolute;
background-color: green;
}
.inline-menu > li:hover > ul{
display: block;
width: 100%; /* same width as parent */
}
.inline-menu.left-menu{
float: left;
}
.inline-menu.right-menu{
float: right;
}
.inline-menu.middle-menu{
}
Flexbox can do that:
body {
background-color: #eee;
padding: 0;
}
nav {
display: flex;
justify-content: space-between;
}
.inline-menu,
.inline-menu ul {
list-style: none;
padding: 0;
margin: 0;
}
.inline-menu > li {
display: inline-block;
padding-right: 25px;
background-color: yellow;
position: relative;
}
.inline-menu a {
text-decoration: none;
}
.inline-menu > li > ul {
display: none;
position: absolute;
background-color: green;
}
.inline-menu > li:hover > ul {
display: block;
width: 100%;
/* same width as parent */
}
.inline-menu.left-menu {
float: left;
}
.inline-menu.right-menu {
float: right;
}
.inline-menu.middle-menu {
float: left;
}
<nav>
<ul class="inline-menu left-menu">
<li>Left-A
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
<li>Left-B
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
</ul>
<ul class="inline-menu middle-menu">
<li>Middle-A
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
<li>Middle-B
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
</ul>
<ul class="inline-menu right-menu">
<li>Right-A
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
<li>Right-B
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
</ul>
</nav>
When I hover over the menu item "support" the text start wont appear in the drop down menu.
I've checked my css over and over again. But i can't seem to find where it is going wrong.
HTML Code
<body>
<div class="site_header">
<div class="header_container">
<div class="header_logo">
</div>
<nav>
<ul class="header_menu">
<li>Home</li>
<li>Support
<ul class="header_sub_menu">
<li>Lorum ipsum</li>
<li>Anime</li>
<li>Gundam Seed</li>
<li>Fairytail</li>
</ul>
</li>
<li>Forums</li>
<li>Ask Question</li>
<li>Help</li>
<li>Feedback</li>
</ul>
</nav>
</div>
</div>
CSS Code
body {
line-height: 1;
background-color: brown;
font-family: Century Gothic;
}
ol, ul {
list-style: none;
}
.site_header{ background-color: black; height: 50px; position: relative; }
.header_container{
height: 50px;
width: 1100px;
margin-left: auto;
margin-right: auto;
position: relative;
}
.header_menu {
left: 90px;
position: relative;
cursor: pointer;
}
li a {
color: #f2f2f2;
display: inline;
float: left;
padding: 12px 10px 22px 11px;
margin: 0px 0px 0px 6px;
font-size: 0.831em;
text-decoration: none;
}
li a:visited{
color: #f2f2f2;
}
ul li a:hover {
background-color: #dadada;
color: black;
}
ul li ul{
display: none;
}
ul li:hover ul{
display: block;
position: absolute;
color: green;
}
ul li:hover ul li a{
background-color: #f2f2f2;
color: red;
display: block;
width: 200px;
}
ul li:hover ul li a:hover {
background-color: #989898;
}
Look at this fragmet:
<ul class="header_sub_menu">
<li>Lorum ipsum</li>
<li>Anime</li>
<li>Gundam Seed</li>
<li>Fairytail</li>
</ul>
I think you meant this:
<ul class="header_sub_menu">
<li>Lorum ipsum</li>
<li>Anime</li>
<li>Gundam Seed</li>
<li>Fairytail</li>
</ul>
The problem is not with the CSS - it's with the HTML. You have placed the contents of the anchor tags of the sub menu outside the 'a' tag and as a direct child of the 'li' tag. Correcting that should fix your error.
You can checkout the fiddle below:
http://jsfiddle.net/E4G3Z/
This is corrected copy:
<div class="site_header">
<div class="header_container">
<div class="header_logo">
</div>
<nav>
<ul class="header_menu">
<li>Home</li>
<li>Support
<ul class="header_sub_menu">
<li>Lorum ipsum</li>
<li>Anime</li>
<li>Gundam Seed</li>
<li>Fairytail</li>
</ul>
</li>
<li>Forums</li>
<li>Ask Question</li>
<li>Help</li>
<li>Feedback</li>
</ul>
</nav>
</div>
</div>
Replace this (your code):
<ul class="header_sub_menu">
<li>Lorum ipsum</li>
<li>Anime</li>
<li>Gundam Seed</li>
<li>Fairytail</li>
</ul>
With this (corrected):
<ul class="header_sub_menu">
<li>Lorum ipsum</li>
<li>Anime</li>
<li>Gundam Seed</li>
<li>Fairytail</li>
</ul>
I've programmed a css dropdown menu that seems to be working correctly in every browser but Internet Explorer (at least in IE7).
Here's a link to a picture of how it looks when it behaves correctly (not enough rep to post pictures yet):
http : // img535imageshack.us/i/chromeexample.png/
Here's a link to how it looks in IE:
http : // img299.imageshack.us/i/ieexample.png/
If you want to view the whole website, it's at urbanpromise.org
Here's the css menu coding:
.menu{
width: 40em;
height: 2em;
background: #63089C;
float: left;
font-family: helvetica, arial, sans-serif;
}
.menu ul{
list-style: none;
float: left;
padding: .4em .75em;
margin: 0;
text-align: center;
font-weight: bold;
color: white;
}
.menu a{
text-decoration: none;
color: white;
}
.menu ul:hover{
color: black;
background: white;
}
.menu a:hover{
color: black;
background: white;
}
.menu ul ul{
position: absolute;
z-index: 500;
text-align: left;
}
div.menu ul ul{
display: none;
font-weight: normal;
}
div.menu ul li:hover ul{
display: block;
background: #63089C;
border: 0px solid black;
border-width: .125em 0;
}
Thanks in advance for the help.
Edit: Here is the HTML code for the menu:
<div class="menu">
<ul>
<li><span class="h2">Home</span></li>
</ul>
<ul>
<li>Information <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li>Staff and Board</li>
<li>History and Mission</li>
<li>Media</li>
<!--<li>Speaker Information</li>-->
<li>Contact Us</li>
</ul>
</li>
</ul>
<ul>
<li>Calendars <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li>UrbanPromise School</li>
<li>Summer/Afterschool</li>
<li>Volunteer/Supporter</li>
</ul>
</li>
</ul>
<ul>
<li>Programs <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li>StreetLeader</li>
<li>Afterschool Programs</li>
<li>UrbanPromise School</li>
<li>Summer Camps</li>
<li>Internship</li>
</ul>
</li>
</ul>
<ul>
<li>Get Involved <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li>Donate</li>
<li>Volunteer</li>
<li>Workgroups</li>
<li>Store</li>
</ul>
</li>
</ul>
<ul>
<li> Blog
</li>
</ul>
</div>
I tried adding display: inline to .menu with no effect, and when I added it to .menu ul or added it to both this was the result in IE7:
http://img830.imageshack.us/img830/9855/ieresult.png
Edit #2: SOLUTION: I fixed the problem using someone's project on Google Code that uses javascript to make IE behave like a more standard browser. Here's a link!
http: //code.google.com/p/ie7-js/
You probably have either a double margin float bug or a collapsed parent with floats bug.
I'd add display: inline; to .menu and/or .menu ul.
This is probably (hopefully) a pretty simple question, but I can't seem to get it to work so I'll turn to the experts here. I'm using a pretty straightforward CSS drop-down menu, with just a little JQuery involved. The issue is that when I hover over the drop-down and it opens, it's pushing everything on the page down below it rather then opening over it. I've tried messing with the z-index but that doesn't seem to be the issue. Any tips would be fantastic, thanks in advance.
Here's the HTML; sorry it's not super-pretty, I had to rip out a bunch of stuff to make it simple and generic.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML style="zoom: 100%; ">
<HEAD>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script>
</HEAD>
<BODY class="bodyclass" style="background:#BCE2F1; height: 100%;">
<DIV id="maincontainer" style="min-height: 100%;">
<STYLE type="text/css">
#cssdropdown, #cssdropdown ul { font-size: 9pt; background-color: black; list-style: none; }
#cssdropdown, #cssdropdown * { padding: 0; margin: 0; }
#cssdropdown li.headlink { width: 140px; float: left; margin-left: -1px; border: 1px black solid;
background-color: white; text-align: center; }
#cssdropdown li.headlink a { display: block; color: #339804; padding: 3px; text-decoration: none; }
#cssdropdown li.headlink a:hover { background-color: #F8E0AC; font-weight: bold; }
#cssdropdown li.headlink ul { display: none; border-top: 1px black solid; text-align: left; }
#cssdropdown li.headlink:hover ul { display: block; text-decoration: none; }
#cssdropdown li.headlink ul li a { padding: 5px; height: 15px; }
#cssdropdown li.headlink ul li a:hover { background-color: #CCE9F5; text-decoration: none; font-weight: normal; }
/* #cssdropdown a { color: #CCE9F5; } */
#cssdropdown ul li a:hover { text-decoration: none; }
#cssdropdown li.headlink { background-color: white; }
#cssdropdown li.headlink ul { background-color: white; background-position: bottom; padding-bottom: 2px; }
</STYLE>
<SCRIPT language="JavaScript">
$(document).ready(function(){
$('#cssdropdown li.headlink').hover(
function() { $('ul', this).css('display', 'block'); },
function() { $('ul', this).css('display', 'none'); });
});
</SCRIPT>
<DIV class="navigation_box" style="border: none;">
<DIV class="innercontent">
<DIV style="background: white; float: left; padding: 5px; border: solid 1px black;">
LOGO
</DIV>
<DIV class="navmenu" style="float: right; bottom: 0; font-size: 9pt; text-align: right;">
<SPAN>Logged in as user#example.com</SPAN><BR>
<UL id="cssdropdown">
<LI class="headlink">
One
<UL style="display: none; ">
<LI>Option One</LI>
<LI>Option Two</LI>
<LI>Option Three</LI>
<LI>Option Four</LI>
</UL>
</LI>
<LI class="headlink">
Two
<UL style="display: none; ">
<LI>Option Two-One</LI>
<LI>Option Two-Two</LI>
<LI>Option Two-Three</LI>
</UL>
</LI>
<LI class="headlink" style="width: 80px;">
Three
</LI>
<LI class="headlink" style="width: 300px; padding-top: 2px; height: 19px;">
<FORM action="http://localhost:3000/search" method="post">
<P>
Search:
<INPUT id="searchwords" name="searchwords" size="20" type="text" value="">
<INPUT name="commit" type="submit" value="Find">
</P>
</FORM>
</LI>
<LI class="headlink" style="width: 60px;">
Four
</LI>
<LI class="headlink" style="width: 60px;">
Logout
</LI>
</UL>
</DIV>
</DIV>
</DIV>
<DIV id="contentwrapper" style="clear:both">
<DIV class="innercontent" style="margin: 0px 20px 20px 20px;">
<H1>Some test content here to fill things out a little bit.</H1>
</DIV>
</DIV>
</DIV>
<DIV id="footer" style="clear: both; float: bottom;">
<DIV class="innercontent" style="font-size: 10px;">
Copyright 2008-2010
</DIV>
</DIV>
</BODY>
This is a pretty bad case of unnecessary Javascript to do what can be done via CSS itself. One way or another all you have to do is change:
#cssdropdown li.headlink ul { display: none; border-top: 1px black solid; text-align: left;}
to:
#cssdropdown li.headlink ul { display: none; border-top: 1px black solid; text-align: left;position:absolute;}
Here's an example of an extremely simple and clean drop down menu. Hope it helps you out a bit. I added a lot of comments to help you figure out what the CSS is doing to the HTML.
<style type="text/css">
/* Get ride of default margin's and padding */
ul, li {
margin: 0;
padding: 0;
}
/* Display parent unordered list items horizontally */
ul li {
float: left;
list-style: none; /* Get rid of default Browser styling */
margin-right: 10px; /* Add some space between items */
}
/* Hide inset unordered Lists */
ul li ul {
display: none;
}
/* Un-Hide inset unordered Lists when parent <li> is hovered over */
ul li:hover ul {
display: block;
position: absolute;
}
/* Clear the any element that may be "float: left;" (Essentially moves the item to the next line */
ul li:hover ul li {
clear: left;
}
</style>
<ul>
<li>
Link 1
<ul>
<li>Link 1.1</li>
<li>Link 1.2</li>
<li>Link 1.3</li>
<li>Link 1.4</li>
<li>Link 1.5</li>
<li>Link 1.6</li>
</ul>
</li>
<li>
Link 2
<ul>
<li>Link 2.1</li>
<li>Link 2.2</li>
<li>Link 2.3</li>
<li>Link 2.4</li>
<li>Link 2.5</li>
<li>Link 2.6</li>
</ul>
</li>
<li>
Link 3
<ul>
<li>Link 3.1</li>
<li>Link 3.2</li>
<li>Link 3.3</li>
<li>Link 3.4</li>
<li>Link 3.5</li>
<li>Link 3.6</li>
</ul>
</li>
</ul>