Link to home
Start Free TrialLog in
Avatar of Rowby Goren
Rowby GorenFlag for United States of America

asked on

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
Avatar of JBart_17
JBart_17
Flag of United States of America image

Avatar of downtap
downtap

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

Avatar of Rowby Goren

ASKER

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')
}

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.
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 ..............
SOLUTION
Avatar of JBart_17
JBart_17
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David S.
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

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?
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
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
kravimir, i realize now my previous comment probably didn't make sense based on your most current comment.   Ignore it :)
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;
}

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}
------------------  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}
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thabnks Kravimir.....    I see, adding the body gave it the extra / higher specificity it needed.

Appriciate your help!