Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with Navigation Bar

Featured Replies

Hi, I'm having problems creating a horizontal navigation bar that runs along the top of my webpage. So far I have been able to get it centred, but it is still vertical. It's probably something really simple, but I can't seem to figure out what's wrong and it's annoying me too much!

 

This is the html :

 

<div id=navbar>

<a class="nav" href="index.html" >Home</a>

<a class="nav" href="about.html" >About</a>

<a class="nav" href="contact.html" >Contact Us</a>

</div>

 

and the CSS,

 

a.nav, a.nav:link, a.nav:visited {display:block; width:150px; height:25px; background:#3399CC; border:0px solid #000; margin-top:2px; text-align:center; text-decoration:none; font-family:verdana, arial, sans-serif; font-size:12px; color:#FFFFFF; line-height:25px; overflow:hidden; float:left;}

a.nav:hover {color:#fff; background:#B0E2FF;}

a.nav:active {color:#fff; background:#c00;}

 

#navbar

{

width:200px; margin:0 auto;

}

 

 

Here is a picture of what it looks like now.

post-36595-0-55620400-1328894332_thumb.jpg

#navbar {margin:0 auto;}
#navbar a {float:left}

 

You need to widen the #navbar. 3 x 150px doesn't fit inside 200px.

You then left float every <a> contained within.

 

Remember to clear your floats afterwards.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.