SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detecting where horizontal list menu wraps

    Is it possible to detect where a horizontal list menu wraps? It seems unlikely using purely CSS means, but I'm sure I can't be the first person to encounter the problem.

    Whether I add the delimiter to the left or right of the menu item, I can easily detect and style accordingly the first and last so that leading/trailing delimiters don't exist.

    e.g. menu item | menu item | menu item | menu item

    The problem I have is, where the menu wraps to a second line I'd like there to be no delimiter at the end of the first line or the begining of the second. What currently happens is this:

    menu item | menu item | menu item | menu item |
    menu item | menu item


    or this:

    menu item | menu item | menu item | menu item
    | menu item | menu item


    Is there a tried and tested solution out there, or is it simply "one of those things"?


    Thanks,

    Andy
    From the English nation to a US location.

  2. #2
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From my experience, there's no way of detecting when something is wrapping using CSS or HTML alone. You'd have to use PHP or some other server side script to count the number of items but even then I'm not sure how you'd detect where something was breaking onto two lines.

    The only times that I ever encounter this problem is when text size in a browser is increased but even then I wouldn't worry too much as long as the text is eligible and usable.

    If this is happening at the usual 100% text size then I'd probably reconsider your design and maybe opt for a vertical navigation instead of a horizontal one, where you will have more space for menu items.

    Hope that helps.

  3. #3
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that I'm adding a CMS system to an existing design so there could potentially be few/many short/long menu options. The site as it stands isn't designed in a very expandable way, but I was hoping to make the best of it.

    You confirm what I thought though. There's no easy way.

    OT: I see you're in Derby. What I wouldn't do for some Matlock Bath fish & chips righ now!
    From the English nation to a US location.


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
  •