Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    how do i specify list id's in the html?

    I want to include bulletins in front of certain items in my navigation menu, but not all. How to I go about calling a list id in CSS? For instance, I have home, about, portfolio, and contact buttons in my menu. I want a bulletin before about, portfolio, and contact, but not before home. So how do I style this in CSS?


    Thanks

  • #2
    Regular Coder Donkey's Avatar
    Join Date
    Sep 2003
    Location
    Blackfield UK
    Posts
    312
    Thanks
    1
    Thanked 36 Times in 36 Posts
    What do you mean by "bulletin" do you mean bullets?
    " 90% of everything is crud" - Theodore Sturgeon
    Filthy Beast - a 60's Rock Band

  • #3
    New Coder
    Join Date
    Nov 2010
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ha, yes! sorry, typo

  • #4
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    I usually just call the first li id="head" and the last id="tail"

    Code:
    <ul id="subNav">
     <li>
      <a href="#" id="head" class="entry"></a>
      <a href="#" class="entry"></a>
      <a href="#" id="tail" class="entry"></a>
     </li>
    </ul>
    if you want to style certain ones:

    Code:
    <ul>
     <li id="style1"><a href="#"></a></li>
     <li id="style2"><a href="#"></a></li>
     <li id="style3"><a href="#"></a></li>
    </ul>
    Is this what you are talking about?
    Last edited by Sammy12; 06-29-2011 at 02:07 AM.

  • #5
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts
    i think you can make a class that has
    Code:
    list-style-type:none;
    in it and then have that class called in your li
    <li class="nobullets">stuff</li>

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    No, don't do any of that.

    You can use a simple pseudo-class to target whichever item it is.
    If it is the first item in the list, you can use this:
    Code:
    #nav li:first-child {
     list-style: none;
    }

  • #7
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts
    Quote Originally Posted by Apostropartheid View Post
    No, don't do any of that.

    You can use a simple pseudo-class to target whichever item it is.
    If it is the first item in the list, you can use this:
    Code:
    #nav li:first-child {
     list-style: none;
    }
    aside from the obvious downfall of having to code in class in each <li> is there any other reason it (my suggested method) wouldn't work? Not saying I disagree with your method- I think it's better as it targets the elements accordingly- just wondering if there is an inherent reason inline style would not work in this situation.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #8
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by alykins View Post
    aside from the obvious downfall of having to code in class in each <li> is there any other reason it (my suggested method) wouldn't work? Not saying I disagree with your method- I think it's better as it targets the elements accordingly- just wondering if there is an inherent reason inline style would not work in this situation.
    No, there's nothing particular to the method that will make it not work, and indeed was the method most used when CSS support was substantially more patchy than it is today. I would discourage, however, creating "hooks" which don't have any semantic meaning, which is why I proposed a pure-CSS method.

  • #9
    New Coder
    Join Date
    Nov 2010
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for the info. I get how to style it in HTML but how do I call it in the CSS? The first child thing worked, but only for the 1st one, how do I call on it for the other options in my nav bar?

  • #10
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Use following style to apply bullets to all li:
    li {
    list-style-type:bullet;
    }

    create class nobullet and apply them on particular menu items

    Cheer

  • #11
    New Coder
    Join Date
    Nov 2010
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks! ;D


  •  

    Posting Permissions

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