Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

How do I add bullet buttons o a list

How would I replace the usual text bullets with graphics (such as a checkmark) to a list such as the following:

<ul>
        <li>
              
        </li>
                <li>
              </li>
                <li>
   </li>
        </ul>


Note: I cleaned out some of the non-relevant code, and I may have gone too far with my butchering, but I think you will get the point!

Thanks

Rowby
0
Rowby Goren
Asked:
Rowby Goren
  • 8
  • 4
  • 3
  • +1
3 Solutions
 
downtapCommented:
Here's a link to a great article on it.
http://www.alistapart.com/stories/taminglists/

My suggestion would be to read this part of the article. It talks about placing an image inline. The suggestion above is to change the bullet to one of the standard available list bullets which won't work that well for custom images.


There may be times when you have a list, but you dont want any bullets, or you want to use some other character in place of the bullet. Again, CSS provides a straightforward solution. Simply add list-style: none; to your rule and force the LIs to display with hanging indents. The rule will look something like this:
 
ul {
	list-style: none;
	margin-left: 0;
	padding-left: 1em;
	text-indent: -1em;
	}
Either the padding or the margin needs to be set to zero, with the other one set to 1em. Depending on the bullet that you choose, you may need to modify this value. The negative text-indent causes the first line to be moved to the left by that amount, creating a hanging indent.
 
The HTML will contain our standard UL, but with whatever character or HTML entity that you want to use in place of the bullet preceding the content of the list item. In our case we'll be using &#187;, the right double angle quote: ».

Open in new window

0
 
Rowby GorenAuthor Commented:
Thanks downtap and JBart_17:

I think I wil be going with JBart's suggestion (but will keep downtaps suggestion for future issues):

If the Ul list had this in the html:  

<h3 class="weblinkinfo_HotDealz">  Hot Deals    </h3>

How would I adjust my modification of your link suggestion -- my version is not workin'...

ul weblinkinfo_HotDealz {
list-style-image: url('/images/splat_orange.gif')
}

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
downtapCommented:
Just so you know. IE6 handles the list-image property badly at times. That's why it's not the most widely used technique for custom bullets.
0
 
Rowby GorenAuthor Commented:
Ah, so I would be better off using the non image solution at least for the next year or so.

Can you tell me downtap how to use your suggestion per the below:

If the Ul list had this in the html:  

<h3 class="weblinkinfo_HotDealz">  Hot Deals    </h3>

How would I adjust my modification of your link suggestion ..............
0
 
JBart_17Commented:
i'm no css expert  but try this
ul.weblinkinfo_HotDealz {
list-style-image: url('/images/splat_orange.gif')
}

<ul id="weblinkinfo_HotDealz">
...
</ul>
0
 
downtapCommented:
Don't get me wrong, you can use the technique, my preference in the past has been to use the inline image technique. Plus, I really trust the coders at a list apart magazine.

First, the css for your list would look like this:

ul {
      list-style: none;
      margin-left: 0;
      padding-left: 1em;
      text-indent: -1em;
      }

If you're using a class for the list, you can, otherwise you can't leave it like that. You may need to adjust the padding or margin depending on the bullet.

Now on to the html, which would like so:

<ul>
<li><h3 class="weblinkinfo_HotDealz"><img src="yourbullet.gif">Hot Deals</h3></li>
</ul>
0
 
David S.Commented:
I prefer to use background images.

It might look like this:

li {
  list-style: none;
  padding-left: 20px; /* at least the width of the image */
  background: url(check.gif) 0 50% no-repeat;
}

Open in new window

0
 
Rowby GorenAuthor Commented:
Hi Kravimir (or anyone)

I'm trying your solution with this css:
li {
  list-style: none;
  padding-left: 20px; /* at least the width of the image */
  background: url(http://americatravelnow.com/images/splat_orange.gif) 0 50% no-repeat;
}

On this page.  Look at the list on upper right.

http://americatravelnow.com/

I tried various settings for the padding, but can't seem to get the splat to move to the left.

Any suggestions?
0
 
David S.Commented:
That's because the "ul.weblinkinfo_HotDealz li" rule is overriding the left padding you're setting in the new rule.

Perhaps this would be a good time for you to read up on specificity:
http://www.sitepoint.com/article/get-specific-css-styles
http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html
http://juicystudio.com/displayarticle.php?page=selector-specificity.php
0
 
Rowby GorenAuthor Commented:
Kravimir,

Would it help in the specifity if the code related to the actual module name.  For example, the clas for this particular code is    class="weblinkinfo_HotDealz
0
 
Rowby GorenAuthor Commented:
kravimir, i realize now my previous comment probably didn't make sense based on your most current comment.   Ignore it :)
0
 
Rowby GorenAuthor Commented:
Hi Kravimir,

Actually I don't have a style called "ul.weblinkinfo_HotDealz li" at the moment.

All I have is  

li {
  list-style: none;
  padding-left: 0px; /* at least the width of the image */
  background: url(http://americatravelnow.com/images/splat_orange.gif) 0 50% no-repeat;
}

So far as I can tell, the following are the only other references to to li and ul in the style sheet are the following snippets:

div.module_menu ul {
      margin: 10px 0;
      padding-left: 20px;
}

div.module_menu ul li a:link, div.module_menu ul li a:visited {
      font-weight: bold;
}

0
 
David S.Commented:
In the embedded stylesheet in the page you linked to you have this rule:

ul.weblinkinfo_HotDealz li{clear:left;list-style:none;margin-left:0px;padding-left:0px}
0
 
Rowby GorenAuthor Commented:
------------------  Kravimir ---------------------
In the embedded stylesheet in the page you linked to you have this rule:

ul.weblinkinfo_HotDealz li{clear:left;list-style:none;margin-left:0px;padding-left:0px}
-------------------------------------

Hi
That code might be "embedded" into the programming of the Content Management system I'm using and might not be easily changed.

However, Kravimir, if I add a css modification to the END of the styleshee for the above css -- or if that doesn't work to the header of the page itself -- I think I can fix it.

With that in mind, how can I modify the below to fix the issue of the bullets being too far to the right.
Then I'll probably go and just put it in the header of the page......

ul.weblinkinfo_HotDealz li{clear:left;list-style:none;margin-left:0px;padding-left:0px}
0
 
David S.Commented:
Simply give it higher specificity. One way is to say that it also needs to be a descendant of the "body" element.

body ul.weblinkinfo_HotDealz li {
  list-style: none;
  padding-left: 20px; /* at least the width of the image */
  background: url(http://americatravelnow.com/images/splat_orange.gif) 0 50% no-repeat;
}
0
 
Rowby GorenAuthor Commented:
thabnks Kravimir.....    I see, adding the body gave it the extra / higher specificity it needed.

Appriciate your help!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 8
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now