Results 1 to 6 of 6

Thread: Bullets - UL, LI

  1. #1
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Bullets - UL, LI

    I have a question about the bullet code:
    HTML Code:
    <ul>
    <li>Apples
    <li>Oranges
    <li>Bananas
    </ul>
    Take that bunch of code for example. The <li> tags produce a bullet, just a normal dot. But i was wondering if you could modify that so that the <li> tag produces an arrow like this:
    >Apples
    >Oranges
    >Bananas

    But don't want to have to do an alt + num before each link to make my bullets. Any way to modify the <li> or the <ul> tag to do that?

    This may be CSS, which I have a pretty good knowledge of, but i'm not sure.

    Thanks in advance.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    HTML Code:
    <style type="text/css">
    li {
    list-style-type:none;
    }
    </style>
    
    <ul>
    <li>> Apples
    <li>> Oranges
    <li>> Bananas
    </ul>
    Notes: You can also use the ul selector in the style section with the same result or a class or id could be employed in the usual manners. The list-style-image property could be used as well however, it sometimes renders oddly, suffering from the same peculiarities as rollover images, and then some. Perhaps with preloading these could be overcome.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Never use > or < in HTML without escaping them. You want to use &lt; for < or &gt; for >. You also ought to close those LI tags.
    Code:
    <style type="text/css">
    li {
      list-style-type: none;
    }
    </style>
    
    <ul>
      <li>&gt; Apples</li>
      <li>&gt; Oranges</li>
      <li>&gt; Bananas</li>
    </ul>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Allright, but the reason I asked was because I didn't want to have to write out &lt before each bullet text. So can i do this?
    Code:
    <style type="text/css">
    li {
    list-style-type:&lt;
    }
    </style>
    Would that put the &lt (>) every time i wrote <li> in my html document?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I don't see the harm in >, there may be some, I don't know. Probably just that it won't validate, if that. Anyways, the right pointing carrot is not available via css as a bullet symbol. There is some advanced css, not supported by IE6 that will allow 'insertion before', that would work, but, as I say, it doesn't in IE6. That leaves writing whatever character in whatever manner you choose for each li or using the the list-style-image property. For that, you make a small .gif of your preferred symbol, then use:

    Code:
    li {
    list-style-image:url('my_list_bullet.gif');
    }
    In your stylesheet. As I said, this sometimes looks odd but, as long as you are not changing it dynamically, should be fine.
    Last edited by jscheuer1; 02-26-2006 at 05:26 PM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok. Thanks .

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
  •