I have wasted too much energy and time trying to create this footer in HTML/CSS, I just can't get it right. I was told the best way of doing this was using <ul> and <li>'s, but getting it aligning correctly is a challenge!
This is what it should look like
This is what my version looks like
What I've tried to do is the following: (CSS is below).
<div class="footer">
<div class="wrapper">
<div class="footer_container">
<ul>
<li><strong>Title/header</strong>
<ul>
<li>Adresse, street</li>
<li>Tlf: Phone</li>
</ul>
<ul class="right">
<li>Zipcode/City</li>
<li>Mail: Email</li>
</ul>
</li>
<li><strong>Links</strong>
<ul>
<li>Om skolen</li>
<li>Galleri</li>
</ul>
<ul>
<li>Elever</li>
<li>Forældre</li>
</ul>
<ul class="right">
<li>Kalender</li>
<li>Fag</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
.footer { background:url(images/footer_bg.png) top repeat-x #e4e2de; width:100%; padding:20px 0 30px 0; }
.footer ul { margin: 0; padding: 0; list-style: none; }
.footer ul li { display: inline; margin-left: 25px; }
.footer_container { margin:22px 0 0 0; }
.footer_container ul { margin:0; padding:0; color:#413f3d; width:100%; }
.footer_container ul li { display:inline-block; list-style:none; margin:0; font-size:11px; text-align:left; vertical-align:top; padding:0; width:270px; }
.footer_container ul li ul { width:120px; float:left; }
.footer_container ul li ul li { display:block; width:auto; }
.footer_container ul.right { float:right; }
I have inserted the 3 images yet as, the 2nd box doesn't look any good.
I'm open to any suggestions/idéas!
Thank you
I would change it up and instead use containers inside the footer instead.
HTML
<div class="footer_container">
<div class="container">
<strong>Title</strong>
<ul>
<li>Adresse</li>
<li>Tlf: Phone</li>
<li>Zipcode/City</li>
<li>Mail: Email</li>
</ul>
</div>
<div class="container">
<strong>Links</strong>
<ul>
<li>Om skolen</li>
<li>Elever</li>
<li>Kalender</li>
<li>Galleri</li>
<li>Forældre</li>
<li>Fag</li>
</ul>
</div>
<div class="container">
Your FB/Twitter things
</div>
</div>
CSS
.footer_container{
width: 960px;
}
.footer_container strong{
font-weight: bold;
}
.footer_container div.container{
width: 320px;
float: left;
}
.footer_container ul{
list-style: none;
margin: 0;
padding: 0;
}
.footer_container ul li {
width: 160px;
float: left;
}
Demo
Over at jsFiddle.
Related
I am new to css my dropdown menu is hiding behind the div please help me to find out the problem. my HTML and CSS code is:
<style>
*
{
margin:0px;
padding:0px;
}
body
{
background-color:mintcream;
}
#header
{
height:260px;
width:auto;
margin:5px;
}
#headerimg
{
height: 260px;
width:100%;
}
#wrap #menu
{
width:550px;
margin:0 auto;
padding:10px;
}
#wrap
{
height:50px;
background-color:lightsalmon;
border:1px solid white;
border-radius:5px;
}
#wrap #menu ul li
{
background-color:black;
border-radius:5px;
width: 120px;
height: 30px;
line-height: 30px;
float: left;
text-align: center;
list-style-type:none;
margin-left: 3px;
}
#wrap #menu ul li a{
color:white;
text-decoration:none;
display:block;
}
#wrap #menu ul li a:hover
{
background-color:mistyrose;
color:orangered;
border-radius:5px;
}
#wrap #menu ul li ul li
{
display:none;
}
#wrap #menu ul li:hover ul li
{
display:block;
}
#content
{
width:100%;
height:500px;
background-color: teal;
margin:5px;
}
#content1
{
width:50%;
height:500px;
background-color: yellow;
float:left;
}
#content2
{
width:50%;
height:500px;
background-color:red;
float:left;
}
</style>
<body>
<div id="header">
<img id="headerimg" src="doc.jpg" />
</div>
<div id="wrap">
<div id="menu">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Contact Us</li>
<li>Services
<ul>
<li>Food</li>
<li>Hospital</li>
<li>Medical</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content">
<div id="content1"> </div>
<div id="content2"> </div>
</div>
</body>
I am new to css. My dropdown menu is hiding behind the div. Please help me to find the problem.
Please add below css
ul {position: relative; z-index: 99999; }
Just add position:relative in "#wrap #menu ul li" . I think your problem was solved. If you have any other problem then put it here.
Thanks for asking.
Consider this markup:
<nav>
<div id="logo"><img src="logo.png" height="44PX"/></div>
<ul id="navItems">
<li>Link1</li>
<li>Link2</li>
</ul>
</nav>
I used this css code for styling:
#navItems
{
display:flex;
z-index:1;
position:fixed;
top:0;
background-color:#333;
width:92%;
height:44px;
list-style-type:none;
}
How to place the logo on the left, just next to the navbar?
If you're using display:flex, can't you just use display:inline-flex?
#logo {
display: inline-flex;
}
#navItems
{
display:inline-flex;
z-index:1;
position:fixed;
top:0;
background-color:#333;
width:92%;
height:44px;
list-style-type:none;
}
<nav>
<div id="logo"><img src="logo.png" height="44PX"/></div>
<ul id="navItems">
<li>Link1</li>
<li>Link2</li>
</ul>
</nav>
I made you the simplest possible navbar
DEMO
html,
body {
margin: 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
ul img {
height: 50px;
float: left;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #111;
}
<nav>
<ul>
<img src="http://doc.jsfiddle.net/_downloads/jsfiddle-logo.png" alt="">
<li>Link1
</li>
<li>Link2
</li>
</ul>
</nav>
Sorry for the n00b questions but here goes:
As seen in the screenshot, I can't align the text list items to the nav bar. Refer to the code so you can see what i'm talking about. It's a bit of a mess but what I basically have is a master div that holds the other divs in attempts to keep them "organized"
If anyone can help, it'd be great. thanks!
Screenshot here: http://imgur.com/dL1eMXR
HTML
<div class="masterwrappernav">
<div class="abovenav">
<div class="logowrappers">
<div id="logo">
<img src="img/logo.png">
</div>
<div id="slogan">
<img src="img/1pyramid.png">
</div>
</div>
</div>
<div class="headernav">
<div class="nav">
<ul>
<li>Home</li>
<li>About</li>
<li>Articles</li>
<li>Devotions</li>
<li>Bible Study</li>
<li>Schedule</li>
<li>Merchandise</li>
<li>Contact Us</li>
<li>Donations</li>
</ul>
</div>
</div>
</div>
CSS
.masterwrappernav {
background-color:#11120D;
width:100%;
height:180px;
margin:0 auto;
}
.abovenav {
background-image:url('/img/wtmot.png');
background-color:#f7f7f7;
width:100%;
height:140px;
margin:0 auto;
box-shadow: 1px 1px 18px #D6D6D6;
}
.headernav {
position:absolute;
background-image:url('/img/grad.png');
background-color:#f7f7f7;
height:40px;
width:100%;
box-shadow: 1px 1px 10px #212121;
text-align:center;
}
.nav {
position:relative;
margin: 0 auto;
}
.nav ul li {
display:inline;
font-family:'Roboto', sans-serif;
font-size:19px;
}
.nav ul li a:link {
border-left:1px solid;
padding:9px 1%;
background-image:url('/img/grad.png');
background-color:#f7f7f7;
color:#454443;
text-decoration:none;
}
Thanks in Advanced
You have a fixed height of 40px on your .headernav. Auto height can fix the alignment problem.
.headernav {
height: auto;
}
Otherwise, if you want exact 40px height for .headernav you can use this snippet below-
.nav ul {
margin-top: 5px;
}
.nav ul li a:link {
padding-top: 0;
padding-bottom: 0;
}
you're messing around with "position: absolute;" without any need IMHO and your UL/LI get some auto-assigned margin/padding - use a RESET!
Look at this jsfiddle for a possible way to a solution.
CSS:
.masterwrappernav
{
background-color:#11120D;
height:180px;
margin:0 auto;
}
.abovenav
{
background-color:#f7f7f7;
height:140px;
margin:0 auto;
box-shadow: 1px 1px 18px #D6D6D6;
}
.headernav
{
background-color:#f7f7f7;
height:40px;
width:100%;
box-shadow: 1px 1px 10px #212121;
text-align:center;
}
.nav
{
margin: 0 auto;
}
.nav ul { margin: 0; padding: 0; }
.nav li { margin: 0; padding: 0; }
.nav ul li
{
display:inline;
font-family: sans-serif;
font-size:19px;
height: 40px;
line-height: 40px;
}
.nav ul li a:link
{
border-left:1px solid;
padding:9px 1%;
background-color:#f7f7f7;
color:#454443;
text-decoration:none;
}
HTML:
<div class="masterwrappernav">
<div class="abovenav">
<div class="logowrappers">
<div id="logo"><!--<img src="img/logo.png" alt="LOGO">--></div>
<div id="slogan"><!--<img src="img/1pyramid.png" alt="PYRAMID">--></div>
</div>
</div>
<div class="headernav">
<div class="nav">
<ul>
<li>Home</li>
<li>About</li>
<li>Articles</li>
<li>Devotions</li><li>Bible Study</li>
<li>Schedule</li>
<li>Merchandise</li>
<li>Contact Us</li>
<li>Donations</li>
</ul>
</div>
</div>
</div>
I am trying to make a vertical menu, but everytime when i show the sub menu on hover, it expands the previous element, making a 'bigger box'. I have no idea how to style that.
Dont want to use some jquery plugin if there is an css solution. I have also bootstrap3, but there is no support for nested dropdowns, dropdowns inside dropdowns ... the nested ones did not open...
JSFiddle link: http://jsfiddle.net/WqW5j/
index.html
<div class="nav">
<ul class="main">
<li>1</li>
<li>2</li>
<li>
3
<ul class="sub">
<li>3-1</li>
<li>3-2
<ul class="sub">
<li>3-2-1</li>
<li>3-2-2
<ul class="sub">
<li>3-2-2-1</li>
<li>3-2-2-2</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
css
.main{
list-style: none;
padding:0px;
margin: 0px;
}
.main li{
background-color:#f1f1f1;
padding: 10px;
margin: 5px;
float:left;
clear:both;
}
.main li:hover{
background-color:#d8d8d8;
}
.main .sub{
display: none;
}
.sub > li > .sub{
display: none;
}
.main > li:hover > .sub:nth-of-type(1){
display: block;
position: relative;
left: 20px;
top:-30px;
list-style: none;
float:left;
width: 100px;
clear: both;
}
.sub > li:hover > .sub{
display: block;
position: relative;
left: 20px;
top:-30px;
list-style: none;
float:left;
width: 100px;
}
To get the nested menu work make all the li items position:relative and make the ul displayed on hover as position:absolute.
Check this fiddle
HTML:
<div class="nav">
<ul class="main">
<li>1
<ul class="sub">
<li>1-1
<ul class="sub">
<li>1-1-1</li>
<li>1-2-1</li>
</ul>
</li>
<li>1-2
<ul class="sub">
<li>1-2-1</li>
<li>1-2-2</li>
</ul>
</li>
</ul>
</li>
<li>2</li>
</ul>
</div>
CSS
.main{
list-style: none;
padding:0px;
margin: 0px;
}
.main li{
background-color:#f1f1f1;
padding: 10px;
margin: 5px;
float:left;
clear:both;
position:relative;
}
.main li:hover{
background-color:#d8d8d8;
}
.main .sub{
display: none;
list-style:none;
padding-left:0;
width:auto;
}
.main .sub li{
float:none;
}
.main > li:hover > .sub{
display:block;
position:absolute;
top:0;
left:100%;
}
.sub li:hover .sub{
display:block;
position:absolute;
top:0;
left:100%;
}
I'm sure I've just made a silly error with this, but I can't seem to make it work it out.
My list items in my nav are not starting at the edge of my div, it's almost like there is a margin on the left.
HTML
<div class="container">
<div id="topline"> blah blah </div>
<div class="leftbox">
<img src="images/totalbulllogo.svg" alt="Total Bull Clothing Company Logo" />
</div>
<div id="banner">
<img src="images/totalbullbanner2.jpg" alt="Total Bull Clothing Company Logo" />
</div>
<div id="navmenu">
<ul>
<li class="active">HOME</li>
<li>ABOUT</li>
<li>STORE</li>
<li>SALE ITEMS</li>
<li>CONTACT</li>
</ul>
</div>
<div id="mainContent"> FEATURED ITEMS</div>
</div>
CSS
html, body {
margin:0;
padding:0;
font-family: Calibri, Arial, sans-serif;
}
#font-face {
font-family:'Neon 80s';
src:url('../fonts/neon.ttf'),
url('../fonts/neon.eot');
}
.container {
clear: both;
margin: 0 auto;
padding: 0;
width: 58%;
background-color: #FFFFFF;}
#topline { float:left;
text-align:right;
padding: 0;
width: 100%;
height: 5%;
background-color: #FFF;
margin-top:2%;
margin-bottom:2%;}
.leftbox {
float:left;
padding: 0;
width: 30%;
background-color: #5D2F92;}
.leftbox img {width: 96%;
margin-left: 3%
margin-right:1%;}
#banner img {width: 100%;}
#banner {float:left;
width:68%;
margin-left:2%;}
#navmenu {
float:left;
padding: 0;
width: 30%;
background-color: #5D2F92;
height: 100%;
margin-top:0.5%;
font-family:'Neon 80s';
font-size:18pt;
text-align:left;
}
#navmenu li {
list-style:none;
margin: 0;
}
#navmenu li a {text-decoration:none;
color:#FFFFFF;
margin: 0;
display:block;
padding:20px 0px;}
#navmenu li.active a {background-color:#C49A6C;}
#mainContent {float:left;
width:68%;
background-color:red;
text-align:center;
margin-top:0.5%;
margin-left:2%;}
You forgot to reset the browser ul default CSS values.
By default, depending on the browser, there are some attribute values assigned to some elements, in case of the ul has some margin and padding. So in order to fix this, you should reset these values as follows:
http://jsfiddle.net/gespinha/dW9wB/1/
#navmenu ul{
margin:0;
padding:0;
}