SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Align Menu to fit center?

    ---EDIT---
    Ok I have decided to remove the align center tag and leave the site left aligned because the menu works at that, if anybody does ever find a simple soultion or is willing to give with the javascript coding please PM me, thanks everybody for their advice. ----EDIT----



    I have just implemented a DHTML menu into my website, and I can't ge the dropdown menus to align center, like the tables, how is this possible. The site looks fine at 800*600, but not at higher resoultions.

    Any help or advice will be great.

    Michael Prosser
    Last edited by mic2020; Jun 18, 2001 at 15:47.

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I don't think anyone will be able to help without being able to see a page using the menu, can you post a link ?

    Sean

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2001
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops, sorry I meant to give a link:

    This is just a tempory site, whilst I am still designing.

    http://www.digibox24.com/test2/index.htm

  4. #4
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    did you resolve your problem?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mic2020, unfortunately you cannot achieve a centered dropdown menu using CSS without:

    a) Extensive javascript coding
    b) dHTML Builder from XFX Software

    I had this problem on a site that I was working on. I could NOT get it to remain centered. Then I found dHTML Builder and all of my problems were solved. It
    s amazing. I defintely recommend you check it out.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  6. #6
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got something working in IE5.5 but it was still left aligned in Opera. I haven't tested it in N6 so that might go pear shaped as well.

    The code you're using was designed for a left aligned page so using position: absolute for the menus is ok. But you need to create a centre aligned box that the menus sit in. However, the only way I could think of doing this was to create 2 boxes. The outer is 100% wide and content centred. Then put a box inside the outer one that's 750px wide. The menus then sit inside the inner box. As the inner box has position: relative the menus should take their positioning relative to the inner box (I think).


    Styles that I used.
    Code:
    <style>
    	body {
    	 margin: 0px;
    	 padding: 0px;
    	}
    	.outercontainer {
    		border-width: 2px;
    		border-style: solid;
    		border-color: #FF66EE;
    		position: absolute;
    		top: 130px;
    		left: 0px;
    		width: 100%;
    		height: 25px;
    		text-align: center;
    	}
    	.container {
    		position: relative;
    		width: 750px;
    		height: 20px;
    		border-width: 2px;
    		border-style: solid;
    		border-color: #33cc99;
    		text-align: left;
    	}
    </style>
    HTML
    Code:
    <div class="outercontainer">
      <div class="container">
    
      <!-- menus html goes here -->
    
      </div>
    </div>
    You'll need to adjust the left, top positioning of menus and maybe the container boxes. (I found top: 25px for menus to be about right). I've used borders just so you can see the boxes.

    As I said this may not work in N6 so it may be worthless. If so, I'd heed Creole's advice (he's done some nice dhtml menus himself, so he knows what he's talking about).


Bookmarks

Posting Permissions

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