Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6809981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:09:03+00:00 2026-05-26T20:09:03+00:00

OK! I just started HTML and CSS today and thought it would be a

  • 0

OK! I just started HTML and CSS today and thought it would be a good approach to learn by building something rather than just reading some text.

[ http://jsfiddle.net/GUkrK/ ]

So I decided to build one sample navigation bar.

<html>
<head>
    <title> navigation bar </title>
    <link rel="stylesheet" type="text/css" href="menu.css">
</head>
<body>
    <ul id="menu">
        <li id="menu1">
            <a href="http://www.google.com">
                <span>GOOGLE</span>
            </a>
        </li>
        <li id="menu2">
            <a href="http://www.github.com">
                <span>GITHUB</span>
            </a>
        </li>
        <li id="menu3">
            <a href="http://www.quora.com">
                <span>QUORA</span>
            </a>
        </li>
        <li id="menu4">
            <a href="http://www.facebook.com">
                <span>FACEBOOK</span>
            </a>
        </li>
    </ul>
    <hr/>
</body>
</html>

and the css

ul {
    list-style:none;
color:red;
}

#menu {
    float:left;
    vertical-align:middle;
    display:block;
    width:600px;
    height:108px;
}

#menu li {
    display:inline;
    font-size:20px;
    padding:0px;
}

#menu a:link {
    color:white;
    font-weight:bold;
    padding:20px;
    background-color:#27A285;
}

#menu a:hover {
    background-color:#E1C618;
    color:brown;
}

hr {
    height:5px;
    background-color:red;
}

But now my problem is the positioning of that horizontal line. Do I have to place that by setting the pixels in absolute or relative positioning? Can’t it be done automatically?
And how come the horizontal line does not cover the total width of the browser? and Can I adjust the width of that horizontal line?

EDIT: Thanks everyone. Here is the edited sample http://jsfiddle.net/sunu0000/zdDU5/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:09:04+00:00Added an answer on May 26, 2026 at 8:09 pm

    Remove float: left; from the CSS definition of #menu.

    Sample

    http://jsfiddle.net/Y8AAH/3/

    CSS for #menu

    #menu {
        vertical-align:middle;
        display:block;
        width:600px;
        height:108px; /* Looks better with like: 40px !! */ 
    }
    

    Depending on what your layout should look like this definition may be sufficient:

    #menu {
        display:block;
        height:108px; /* Looks better with like: 40px !! */ 
    }
    

    Updated sample: http://jsfiddle.net/Y8AAH/4/

    Updated sample with centered menu

    #menu {
        height:40px;
        text-align: center;
    }
    

    http://jsfiddle.net/Y8AAH/5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started creating my first WP theme after doing the HTML/CSS. All good
I just learned ruby, and already have some html/javascript/css background. When i learn rails
I've just recently started learning HTML/CSS and I've been trying to teach myself sound
I have just started ASP .NET recently, I already know C# HTML and CSS
I just started to develop Air applications with HTML/CSS/JS. And i was wondering: What
Good Day, I just started to learn HTML5 - have no issues, everything's going
i know HTML/CSS and want to learn WPF styling. how can i get started.
I´ve just started learning GWT and I´m trying to implement http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload and but failing
Just started working with Mercurial a few days ago and there's something I don't
I just started thinking about creating/customizing a web crawler today, and know very little

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.