Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
TDD's Web Design Series - Part 4, basic navigation
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-29-2008, 03:32 PM
Web Design Expert
 
Join Date: Nov 2005
Location: Brisbane, Australia
Posts: 3,190
Default TDD's Web Design Series - Part 4, basic navigation

Alright kiddies, it's been a while since I wrote a guide on web design, completely forgot I even wrote them :P

Today, we are going to make a very basic hover navigation using pure HTML and CSS.

Before we start, you should know and understand something; Internet Explorer 6 will not apply a css :hover to anything but the <a> tag, sadly, so this makes it difficult to do some more fun techniques.

first, you'll need the starting xHTML and CSS, so if you've read the first few tuts of mine, you'll know how to make a reset.css file, make the basic xHTML setup, etc. so do all this.

Whip up the following within your xHTML:

[HTML]
<div class="navigation">
<ul class="navigation">
<li><a href="#"><em>home</em> Go to homepage</a></li>
<li><a href="#"><em>page2</em> Go to Page2</a></li>
</ul><!-- end of ul -->
<div class="clear"></div>
</div><!-- end of navigation -->
[/HTML]

so far, we've got a box model that will look like this:


this is perfect in the HTML, it is logically ordered and has meaning, now we can apply CSS to make this a half-decent navigation:

[HTML]
<style type="text/css">
body {
background-color: #111111;
}

div.navigation {
position: relative;
width: 100%;
margin-top: 0.4em;
border-top-color: #333;
border-bottom-color: #333;
border-style: solid;
border-width: 1px;
}

ul.navigation {
position: relative;
margin-left: 20%;
margin-right: 20%;
width: 60%;
height: 2.4em;
}

ul.navigation li {
float: left;
margin-right: 1em;
position: relative;
margin-top: 0.1em;
}

ul.navigation li a {
position: relative;
display: block;
font-family: "Calibri", Arial, Tahoma, Helvetica, Geneva, sans-serif;
color: #999999;
text-decoration: none;
font-size: 0.8em;
}

ul.navigation li a:hover {
color: #fff;
}

ul.navigation li a em {
font-family: "Calibri", Arial, Tahoma, Helvetica, Geneva, sans-serif;
font-size: 1.4em;
font-style: normal;
font-weight: bold;
text-transform: uppercase;
position: relative;
display: block;
width: 100%;
color: #fff;
}

div.clear {
clear: both;
}
</style>[/HTML]

Here is an explanation of what each rule does:

Code:
body {
background-color: #111111;
}
This applies a dark gray background over the entire document (<body>).

Code:
div.navigation {
position: relative;
width: 100%;
margin-top: 0.4em;
border-top-color: #333;
border-bottom-color: #333;
border-style: solid;
border-width: 1px;
}
The <div class="navigation"> in our code has this CSS, which positions the div and it's contents relative to the parent, which in this case is <body>, the div is the full width of <body>, and is positioned 0.4ems from what is above it. It also has a 1 pixel gray border that applies only to the top and bottom.

Code:
ul.navigation {
position: relative;
margin-left: 20%;
margin-right: 20%;
width: 60%;
height: 2.4em;
}
the <ul class="navigation"> has been placed relative to the parent tag, which is <div class="navigation"> and has been placed 20% to the left and right, with a width that is 60% the total width of the div it is inside of, so basically it's centered no matter what. It also has a total height of 2.4em.

Code:
ul.navigation li {
float: left;
margin-right: 1em;
position: relative;
margin-top: 0.1em;
}
these are the list items within the <ul>, they are to always float to the left, with a space of 1em to their right, again - relative to their parent which is the <ul> from above, and are to be positioned 0.1em from the top of the <ul>

Code:
ul.navigation li a {
position: relative;
display: block;
font-family: "Calibri", Arial, Tahoma, Helvetica, Geneva, sans-serif;
color: #999999;
text-decoration: none;
font-size: 0.8em;
}
this is the <a> tag and it's contents, within the <li> inside the <ul>, it is placed relative to the <li> but has a display:block, which means that there is a line break both before and after it, so basically, it displays it all vertically, which is why the <li> is floated to the left, to display those horizontally whilst having line break in the <a>. it uses the custom font "Calibri" (This is abundant on all office 2007 XP systems, or the XP Systems with the update for office 07 files, and all vista systems, so it is safe to use as a first choice, as long as there is a fall back like I have). The text is a gray and has no decoration (no underline that is automatically applied to <a> elements), it has a font size of 0.8em.

Code:
ul.navigation li a:hover {
color: #fff;
}
This says that when the <a> is rolled over, the text turns white.

Code:
ul.navigation li a em {
font-family: "Calibri", Arial, Tahoma, Helvetica, Geneva, sans-serif;
font-size: 1.4em;
font-style: normal;
font-weight: bold;
text-transform: uppercase;
position: relative;
display: block;
width: 100%;
color: #fff;
}
this says that the contents of the <em> withing the <a> above is 1.4em in height, is not italicised like it would normally (<em>, better known as the emphasis tag is auto applied with italics text). The font shall be bold and automatically converted to uppercase (Capitals).

Code:
div.clear {
clear: both;
}
This just clears the floats from the <li>, it is needed to fix browser bugs.

But Mat, WHAT THE FUCK IS ALL THIS "EM" SHIT YOU SAY AS SIZES IN THE CSS!?!?!?!

em is a relative value to the end user's default font size, which usually is 16pt, so "1em = 16pt in font size", it means that the layout is elastic according to the user's preferences, it helps prevent breakage in the layout on larger-font browsers and whatnot - just a technique I wanted to show you

Hopefully, you got a navigation like this below:

[IMG][/IMG]

and there you have it, a simple yet effective navigation that works. No tables, no images, pure xHTML/CSS.

Reply With Quote
  #2  
Old 09-29-2008, 03:34 PM
TDD's anal whore
 
Join Date: Mar 2007
Location: The Land of Aus
Posts: 172
Default Re: TDD's Web Design Series - Part 4, basic navigation

Thank you, thank joo soo much TDD, your tutorials haff taught me sooo much about web design, you are a god amongst all men.

*Prays to Mat*
__________________
Reply With Quote
  #3  
Old 09-29-2008, 04:39 PM
Apprentice
BANNED
 
Join Date: Jul 2007
Location: ██████████████&#
Posts: 864
Send a message via ICQ to M0rphine Send a message via AIM to M0rphine Send a message via Yahoo to M0rphine
Default Re: TDD's Web Design Series - Part 4, basic navigation

Nice tut! im trying to get into web design, this will help make things a little easier.
Reply With Quote
  #4  
Old 09-30-2008, 05:38 AM
biliyad1's Avatar
Forum Addict
$5 USD Donor
 
Join Date: Jul 2007
Posts: 591
Default Re: TDD's Web Design Series - Part 4, basic navigation

GREAT tut! Thanks.
I plan to use it later in other CSS things, like skinning.
__________________


I will never decline a Sythe PM to verify my identity.
I will never decline using an OMM.
I will never scam, ever.

my://vouches.xD
Reply With Quote
  #5  
Old 09-30-2008, 05:15 PM
Apprentice
BANNED
 
Join Date: Sep 2008
Posts: 766
Default Re: TDD's Web Design Series - Part 4, basic navigation

Wow, this is really good. How much would it cost to hire you to make a website for me, TDD?
Reply With Quote
  #6  
Old 09-30-2008, 06:28 PM
Jansen's Avatar
Retired Admin :'(
Ex-Moderator
 
Join Date: Apr 2005
Posts: 5,162
Send a message via MSN to Jansen
Default Re: TDD's Web Design Series - Part 4, basic navigation

protip:

study this, don't copy and paste it.
__________________
Heya.
email me if you're looking for me.

jansen [at] jansentolle [dot] com
Reply With Quote
  #7  
Old 10-09-2008, 10:01 AM
Web Design Expert
 
Join Date: Nov 2005
Location: Brisbane, Australia
Posts: 3,190
Default Re: TDD's Web Design Series - Part 4, basic navigation

Quote:
Originally Posted by Fratal View Post
Wow, this is really good. How much would it cost to hire you to make a website for me, TDD?
probably more then someone like you is willing to pay
Reply With Quote
  #9  
Old 10-23-2008, 01:23 PM
Guru
 
Join Date: Apr 2007
Location: Newcastle, Australia
Posts: 1,115
Send a message via Skype™ to 1337it
Default Re: TDD's Web Design Series - Part 4, basic navigation

Thanks mate, i'll give this ago tomorrow and edit by post
Reply With Quote
  #10  
Old 11-03-2008, 03:08 PM
Legend
Java Programmers Pirate
 
Join Date: Jan 2007
Posts: 10,910
<3 n4n0
Default Re: TDD's Web Design Series - Part 4, basic navigation

You is taught me what em means. I is in your dept.

__________________
PM me with any issues.

I do not MM or trade anything.
Anyone claiming to be me in a trade or MM is an imposter.
Reply With Quote
  #11  
Old 11-03-2008, 09:04 PM
Forum Addict
BANNED
 
Join Date: Aug 2008
Location: Australia
Posts: 323
Default Re: TDD's Web Design Series - Part 4, basic navigation

another great tut fromt tdd
Reply With Quote
  #12  
Old 12-13-2009, 02:01 AM
CLD''s Avatar
Active Member
 
Join Date: Dec 2009
Location: Zuboid.co.cc
Posts: 133
Send a message via MSN to CLD'
Default Re: TDD's Web Design Series - Part 4, basic navigation

Goodguide man, thanks.
__________________
CallumLeeDixon



www.Zuboid********

^Click It^

<3
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 09:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1