This thread will be dedicated to improving my coding skills and a place where other new comers can join in on this learning experience with me I will try and post something new I learn everyday.
If you find areas where I can improve such as condensing code please post with instructions on how and what they do Please keep criticism constructive..
To start things off i thought a navigation bar would be a good spot to start so here it is
Basic nav menu html
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Project 1</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="Your site url here">Name of your button</a></li>
<li><a href="Your site url here">Name of your button</a></li>
<li><a href="Your site url here">Name of your button</a></li>
</ul>
</nav>
</header>
<section>
<article>
</article>
<section>
<footer>
</footer>
</body
</html>
CSS for basic nav bar
Code
/*Navigation bar*/
/*===============================*/
nav{
border-width:1px 0;
list-style:none;
margin:1;
padding:1;
text-align:center;
font-size:18px;
}
nav li{
display:inline;
}
advaced nav menu html (cascading)
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Project 1</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<nav>
<ul id="navmenu">
<li><a href="#">main button name</a>
<ul class="sub1">
<li><a href="your link here">Button name</a></li>
<li><a href="your link here">Button name</a></li>
<li><a href="your link here">Button name</a></li>
</ul>
</li><li><a href="#">main button name</a>
<ul class="sub2">
<li><a href="#">Button name</a></li>
<li><a href="#">Button name</a></li>
<li><a href="#">Button name</a></li>
</ul>
</li>
<li><a href="your link here">main button name</a>
<ul class="sub3">
<li><a href="#">Button name</a></li>
<li><a href="#">Button name</a></li>
<li><a href="#">Button name</a></li>
</ul>
</li>
</ul>
</nav>
</header>
<section>
<article>
</article>
<section>
<footer>
</footer>
</body
</html>
Css for advanced nav menu
Code
header li {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul {
list-style-type: none;
padding: 0;
text-align: center;
}
ul#navmenu, ul.sub1, ul.sub2, ul.sub3 {
list-style-type: none;
}
ul#navmenu li {
float: left;
margin-right: 4px;
outline: 1px none;
position: relative;
text-align: center;
width: 125px;
}
ul#navmenu a {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
border-radius: 3px;
display: block;
height: 25px;
line-height: 25px;
text-decoration: none;
width: 125px;
}
ul#navmenu .sub1 a {
margin-top: 3px;
}
ul#navmenu .sub1 li {
border: 1px solid #808080;
}
ul#navmenu .sub2 a {
margin-top: 3px;
}
ul#navmenu .sub2 li {
border: 1px solid #808080;
}
ul#navmenu .sub3 a {
margin-top: 3px;
}
ul#navmenu .sub3 li {
border: 1px solid #808080;
}
ul#navmenu li:hover > a {
background-color: #CCFFCC;
}
ul#navmenu ul.sub1 {
display: none;
left: 0;
position: absolute;
top: 26px;
}
ul#navmenu ul.sub2 {
display: none;
left: 0;
position: absolute;
top: 26px;
}
ul#navmenu ul.sub3 {
display: none;
left: 0;
position: absolute;
top: 26px;
}
ul#navmenu li:hover .sub1 {
display: block;
}
ul#navmenu li:hover .sub2 {
display: block;
}
ul#navmenu li:hover .sub3 {
display: block;
}
This post was edited by Derek on Nov 22 2013 01:31pm