Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS The best way to handle multiple unordered lists?

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #31329
    erikdwallace
    Participant

    Something I run into frequently is conflicting styles with multiple unordered lists]. For example in navigation I use a list with list style set to none and I also use lists with bullets. It seems simple, but often the declarations conflict. I’ve tried different syntax and giving the lists unique IDs with no success.

    Does anyone have a good suggestion for a best practice way to manage multiple lists?

    #65097

    Can you show an example?

    #65098
    erikdwallace
    Participant

    I’m working from home today and my files are on my machine at work. Sorry Brett, here’s essentially what I’m working with:

    #navigation { list-style-type:none; } /* I’ve tried list-style as well */
    #bullets ( list-style-type:disc; }



    • Item One

    • Item Two

    • Item Three

    #65100

    I am struggling to still understand your problem. However, if the CSS you posted above was pasted than here is your answer:

    #bullets ( list-style-type:disc; }
    should be
    #bullets { list-style-type:disc; }

    the opening brace should be { and not (

    #65101
    erikdwallace
    Participant

    Brett,
    That was a typo on my part, that’s unfortunately not the issue. To summarize I have different types of navigation and lists both using unordered lists. Even though I’m using unique id’s I can’t get bullets to appear when I’ve set list style to none in previous declarations. You’d think the last style would overwrite as it usually does, but in this case it isn’t. Does that make more sense?

    Thanks,
    Erik

    #65102

    ul#elementID

    example ul#bullets

    tried that?

    #65104
    erikdwallace
    Participant

    I have indeed. I read an article about best practices on this site which mentioned that ul#elementID is not the best way to code, so I’ve been gradually changing that approach. When possible I just use the id name.

    #65107

    I guess I still don’t understand the problem, sorry I could not fix your issues.

    #65112
    TT_Mark
    Member

    Are you using a reset stylesheet? Or any kind of reset that removed the margins/padding from all elements? You’ll need to reintroduce the padding on the left (I think) on the ul to make the bullets appear

    #65115
    TheDoc
    Member

    You should always be more specific in your CSS. For example:

    #wrapper #main-navigation { … }

    #wrapper #content ul { … }

    #65116
    erikdwallace
    Participant

    I am using Eric Meyer’s reset and have tried adding margin-left and padding-left. I appreciate everyone’s help, I don’t want to waste anyone elses time until I have the exact HTML and CSS I’m using. Thanks to everyone for their help.

    #65117
    TT_Mark
    Member

    Fair enough, I’d recommend using something like Firebug or similar tool, selecting the incorrectly styled element and seeing what CSS rules are being applied

    #65118
    noahgelman
    Participant

    Try adding {list-style:inside;} to the #bullets list. They might be showing up but are outside of view. It’s happened to me a couple of times actually.

    #65056
    erikdwallace
    Participant

    Thanks TT_Mark and noahgelman, I’ll try both when I’m back in the office tomorrow.

    #64903
    erikdwallace
    Participant

    I tried all of the suggestions again with no success. So, I came to the conclusion that I’m obviously coding something wrong with in my CSS. When I switched the unordered list to an ordered list the bullets appeared.

    Thanks to everyone for their help.

Viewing 15 posts - 1 through 15 (of 20 total)
  • The forum ‘CSS’ is closed to new topics and replies.