Jump to content

noob question with positioning


Emwat Oon

Recommended Posts

I'm trying to put a navigation menu at the top, but I don't understand something. Position: Absolute overlaps everything else. Position: Relative seems to throw out all of my formatting out the window and won't include line breaks. Why do I have to work around this positioning to accomplish some kind of header?

 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="cssAttempt.aspx.cs" Inherits="cssAttempt" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title>CSS ATTEMPT</title>    <style>        div {            display: block;        }        div.top{            position: absolute;            width:100%;            color:white;            background-color: black;        }            .top ul {                list-style: none;            }            .top ul li {                float:left; /*Hate: This centers*/            }            .top a {                display: block;                text-decoration: none;            }    </style></head><body>    <form id="form1" runat="server">        <div class="top">            <ul class="top">                <li>HOME</li>                <li>ANYTHING</li>                <li>ANYTHING</li>                <li>ANYTHING</li>             </ul>        </div>    <div>    <h1>Hey</h1>        <p>If you don't see Hey, that means it's been overlapped.</p>    </div>    </form></body></html>

 

 

Link to comment
Share on other sites

In general you don't use relative or absolute positioning unless there is no alternative.

 

Menus are nothing new or unique. What you might try is a search... maybe...

 

http://drop down menu site:http://w3schools.invisionzone.com

Edited by davej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...