Hack Your Mind Right Now....!

  • Home
  • Android
  • C Language
  • Facebook Hacking
    • 20 FB Tricks
    • Animation in FB
  • DeadlyHacker

How To Create Simple Horizontal Navigation Bar From CSS

Posted by Unknown at 3:04 PM

Though there are lots of tutorial about Horizontal listings, I founds lots of beginners having problem in understanding the mess of extra CSS codes added in it. There are several methods to achieve horizontal navigations.
One of them can be simply achieved by placing the sequence of links in a single line and styling it with CSS. Let’s see how to do this.
First of all, lets create a simple links arranged in a same horizontal line.
<A HREF=”#”>Home</A>
<A HREF=”#”>About us</A>
<A HREF=”#”>Portfolio</A>
<A HREF=”#”>Contact us</A>
Now when you save and load it in browser, it will look similar to the image below:
If you are satisfied with just these links in single line, then it is ok you can end the tutorial right here. Else if you want the horizontal navigation links like in Hackspc.com, you’ll have to follow up to the end of this tutorial.
We cannot easily create background effect in <A> without using CSS. So, we’ll need to style it with proper CSS.
Now let’s apply some CSS to the link. But before applying any CSS to the <A> tag, you must note that it must be specific to the horizontal links only. Otherwise, your other content links will also look same as the navigation links. So, let’s make it unique by keeping it inside a div with id menu.
<DIV ID=”MENU”>
<A HREF=”#”>Home</A>
<A HREF=”#”>About us</A>
<A HREF=”#”>Portfolio</A>
<A HREF=”#”>Contact us</A>
</DIV>
Now we’ll define the compound CSS to <A> so that the CSS style only applies to the link inside theMENU id.
Here is the simple CSS:
#MENU A {
Display:block;
Float:left;
Padding: 0 10px;
Background:#CCCCCC;
}
Now the above CSS will be applied to all the <a> tags inside <div id=”menu”>.  By default, <A> tag is a inline tag that doesn’t makes extra spaces, in simple terms it is an object without a box. While blocks are the one which contains four sides, in simple terms it is an object inside a box.
Since, <A> is not a block, we’ll have to manually make it block, this can be done by using display:block; property.  Generally, block occupies full width that they can reach up to. So, whenever we create block, it takes whole width. Look at the image below.
In the above image, you can see that how blocks behaved by occupying the full width. Since, it appeared in different lines, it is not according to our interest. We want all these to appear in same line.
We’ll use CSS floats to appear it in same line. We’ll float these blocks to left. And this is what we have after applying floats.
You can see that, though it appeared in single line this time, it is not what we wanted. The clumsy appearance of the navigation links in the above image looks like it is the single image. We won’t press SPACE key to give some white space here. We’ll be using padding to left and right side to give a little bit space to it.
Let’s set padding of 10 pixels on both sides,
Padding: 0 10px;
We’ll get following results after padding.
Whoa! Finally it appeared in same line. But you might not find any good remarkable difference here with the first image of this tutorial.
At least, we’ve kept it in a box we can apply any CSS effect to it.
Let’s play with the background and border, remove underline and change link color to white,
background:#ccc;
border-left:1px solid #000;
text-decoration:none;
color:#fff;
This will be the result:
Now let’s apply some hover effect to it. To do so, we again have to specify the compound CSS tothe links and add pseudo class, :hover to it.
#MENU A:hover {
Background:#00CCFF;
}
Simply we changed the background color to hex value #00CCFF. Now whenever the mouse is hovered the link box will be highlighted with a color.
The final CSS will look like this:
.MENU A  {
display:block;
float:left;
padding:0 20px;
background:#ccc;
border-right:1px solid #000;
text-decoration:none;
color:#fff;
}
.MENU A:hover  {
background:#0CF;
}
In next tutorial, we’ll see how we can use this method to lists. Till then stay tuned and bookmark us
Email ThisBlogThis!Share to XShare to Facebook

1 comments:

Anonymous said...

It's going to be end of mine day, however before end I am reading this fantastic piece of writing to increase my experience.
Feel free to visit my website - great advertisement

January 30, 2013 at 1:02 AM

Post a Comment

Newer Post Home Older Post
Subscribe to: Post Comments (Atom)

Like Me On Facebook Mr. Deadly Hacker

About The Author

Unknown
View my complete profile
Aman Badhania writes this blog to help computer users with problems related to web services and getting the most out of their own websites.
Feel The Power Of Cyber Hacking Mr. DeadlyHacker

Popular

    Unlist your numbr from Truecaller Unlist your numbr from Truecaller
    no image Office 2013
    IGI 3 The Mark Highly Compressed PC Game Full Version IGI 3 The Mark Highly Compressed PC Game Full Version
    no image Best Windows 8 Activator with Download Link
    Download Game CrashDay Full Rip For PC 100% Working Download Game CrashDay Full Rip For PC 100% Working
    Facebook Recommendation plugin box Error "Invalid action type" Fixed Facebook Recommendation plugin box Error "Invalid action type" Fixed
    How to Search for Posts in the Google+ Directory How to Search for Posts in the Google+ Directory

TemplateHits

  • Home
  • About Me
  • Serial Keys 1million
  • Password Hacking
  • Telnet
  • Hacking
  • Download
  • C Language Tips and Trick
Feel The Power Of Cyber Hacking Mr. DeadlyHacker

Hacking Tricks

Hacked Window Hacking Tools Window Software Window 8 Window Tips How To Make Window Genuiene Window 7 Hacking tutorial IP Tips Internet USB Hacking Hardware IGI 3 Internet Tricks Torrent HD movie HTML Hacker Types Hacking Game Hacking Tips Happy Deepawali Hard Disk Hardware Hacking HitMan Game HoneyPot Hosting IGI 2013 Image 2 Text Information Intrusion Detection System (IDS) Tekken 6 Telnet Terminator RAT TrueCaller UserName VLC Player Hacking Virus Visual Script Tricks Window 10 Window 8 Hack Window 9 Window News Window Server Youtube Tips Zombie iPhone

Crack Skull

Crack Skull
Shiiiiiiiiiiiiiiii.....Don't Live This

Followers

Deadly Tricks

Android Android Tips Android Apps Android Hack AntiVirus Hack Aman Badhania About Keylogging Backtrack Blogger Tips Backup Trick Batch Programming Browser APT Access Block Sites Advance Persistant Threat Albert Einstein Android Code Android Games Android Smart Phone Angry birds Application Assassin’s Creed III AutoCad Batch Hacking Blogger tools Bolloywood Movie HD
Facebook Hacking Firefox Imp. Addons Facebook Tips Download Facbook hack Deadly Hacker Desktop Hacking Exploits Email Hacking Data Recovery Desktop Apps Disable Mouse Dos Tools Drawing Arts Drive Icon Change Ethical Hacking Learn File hosting Firefox Download Flash Software

More Tricks

Software Proxy Server Password Hacking Software hacking Opreting System Partition Make Programming Of linux Remix Hacking Reverse Engineering Samsung Mobile Hacking Skin Pack For Window 7 System Hacking Open Source Code PC Hack PenDrive Bootable PenDrive Hacking Phishing Attacks Phreaking Proxy Sites RainMeters Recover Recover Deleted Files Red Hat Registry Hack Reinstall Your All Drivers In 5 MinutesThis is a featured page Resume Spear Phishing
Computer Hacking Backtrack Blogger Tips Command Hacking Crash Computer Cross Site Scripting (XSS) Backup Trick Batch Programming Browser CRIMINAL HACKED Computer trick Batch Hacking Blogger tools Bolloywood Movie HD C# CSS Check Password Coin Box Calling Hacking Cryptography
Aman Badhania
Copyright © 2012 Hack Your Mind Right Now....! - and Deadly Hacker.