unordered list - strange behavior

This is a discussion on "unordered list - strange behavior" within the Web Page Design section. This forum, and the thread "unordered list - strange behavior are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 6th, 2007, 11:38
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
unordered list - strange behavior

hi,

I'm trying to construct an unordered list with custom bullets. However, the <li> elements appear one after the other (instead of one on top of the other like it should be).

Maybe I have messed up the alignement, I don't know.


CSS:
Code: Select all
.myClass ul.categorylist{
    width: 208px;
    float: left;
    padding: 0;
    margin: 0;
}
.myClass ul.categorylist li{
    background-image: url(../images/category-arrow.gif);
    background-repeat: no-repeat;
    background-position: 0 0;
    display: inline;
    padding-left: 1.5em;
    margin-left: 1.5em;
}
HTML:
HTML: Select all
<div class="myClass">
   <ul class="categorylist">
       <li>category1</li>
       <li>Brand</li>
   </ul>
</div>

Last edited by Marc; Dec 6th, 2007 at 11:42. Reason: Split the html & css up into different boxes so it's easier to read.
Reply With Quote

  #2 (permalink)  
Old Dec 6th, 2007, 11:43
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,650
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: unordered list - strange behavior

Can we see the image called 'category-arrow.gif'?
Reply With Quote
  #3 (permalink)  
Old Dec 6th, 2007, 11:49
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

Code: Select all
display: inline;
What do you expect to happen if you use this code?

This formats the <li>s as inline elements: they behave like text in a paragraph. Consequently, they will line up alongside each other, rather than start a new line.

Take out that line of code, and it should work.
Reply With Quote
  #4 (permalink)  
Old Dec 6th, 2007, 11:50
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,650
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: unordered list - strange behavior

Haha.. That's what i get for not looking past the image line of code!!! DOH!
Reply With Quote
  #5 (permalink)  
Old Dec 6th, 2007, 11:56
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

Marc, you mean: <HomerSimpson>D'oh!</HomerSimpson>
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #6 (permalink)  
Old Dec 6th, 2007, 13:03
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

hi,

the image is just a stupid small image, but it's not the problem.

I also tried removing the "inlined" attribute of <li> but it didn't help. Probably the css for <li> inherits some of the attributes from another element... What should be the "display" attribute?
Reply With Quote
  #7 (permalink)  
Old Dec 6th, 2007, 13:50
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

Should be: { display: block }
Reply With Quote
  #8 (permalink)  
Old Dec 6th, 2007, 14:02
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

thanks

so I guess obviously it inherited the display from a parent node...

Best,
Pesho
Reply With Quote
  #9 (permalink)  
Old Dec 6th, 2007, 14:19
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

uups, I have one more question:

I'd like to add a number on the right of every <li>

Something like:

Code: Select all
 My UL
   * li_1                3
   * blqblq_2           24
   * blqblqblq         318
to my css I add:
Code: Select all
 .myClass ul.categorylist li span.cat-number{
    float: right;
}
my HTML becomes:
Code: Select all
<div class="myClass">
    <ul class="categorylist">
              <li>li_1</li><span class="cat-number">3</span>
              <li>blqblq_2</li><span class="cat-number">24</span>
    </ul>
</div>
Reply With Quote
  #10 (permalink)  
Old Dec 6th, 2007, 14:19
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: unordered list - strange behavior

Quote:
Originally Posted by pesho318i View Post
so I guess obviously it inherited the display from a parent node...
Very likely.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
unordered list problem in FF alexgeek Web Page Design 4 Sep 10th, 2007 15:26
Image bullets on unordered list Kobrakai Web Page Design 4 Aug 15th, 2007 18:27
Strange form submit behavior in IE Donny Bahama PHP Forum 3 Apr 27th, 2007 19:36
Unordered list under background image AdRock Web Page Design 4 Aug 7th, 2006 12:43
CSS Unordered List Problem relph2 Web Page Design 3 Jan 7th, 2006 18:14


All times are GMT. The time now is 03:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43