www.webdeveloper.com
Results 1 to 4 of 4

Thread: How to make menu as static element?

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    1,634

    How to make menu as static element?

    I like to make menu as static option. How to set in the correct way?
    HTML:
    PHP Code:

    <ul id="topmenu" style="top: 0px; position: static;"
    CSS:
    PHP Code:
    element.style {
        
    position: static;
        
    top0;

    Is this correct way inside css file or inside page style='' ''?
    Can be improved?

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,129
    Static is the default option, so yes, it can be improved by simply not including it!
    I'm always up for networking with fellow web professionals. Connect with me on LinkedIn if you like!

  3. #3
    Join Date
    Aug 2012
    Posts
    155
    Keep your styles in your external stylesheet, this is the correct way to format it
    Code:
    #topmenu { 
        position: static; 
        top: 0; 
    }
    HTML Code:
    <ul id="topmenu">
    As position: static is the default positioning used for html elements then you don't need to specify it anyway and you also don't need the top: 0 unless you are positioning absolutely or relatively.

    If you want the menu to stay fixed when scrolling then you would use position: fixed; top: 0;

  4. #4
    Join Date
    May 2003
    Location
    Florida
    Posts
    38
    The correct way to do it is with fixed positioning. using position: fixed; as listed in the previous reply. Just remember that fixed positioning does not work in all browsers, in particular, Internet Explorere 8 and earlier does not recognize fixed positioning and this browser is still the most popular browser worldwide.

    If you want your code to be cross browser compliant I would recommend researching a jquery option to fixed positioning.
    Jawaune Saad

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles