Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
Old 08-19-2008, 03:04 PM Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
SnowTao's Avatar
Average Talker

Posts: 24
Name: Elenor
Location: Cumming, GA
Trades: 0
(Disclaimer: Of course, the coding works perfectly in Firefox. In MISE6, it actually appears as desired. (!) In MSIE7, it breaks. {sigh})

I've got an unordered list -- the bullets are graphical numbers, so each li has a class: "li-1" "li-2" etc. Some of the li's have several paragraphs within the li. If I use the <p> code around the first sentence, the sentence drops down so the graphic number is longer aligned with the top of the text. If I don't use it, then there is a bit of untagged text, which is less-than-optimal (isn't it?). The list is here: http://www.snowtao.com/cave/CSS-gst2008.htm#rumors

I'd rather NOT have to add a tag to every first para in every numbered list (across 200+ pages!)

The CSS

numb-list li {
list-style: none;
line-height: 1.2em;
}

.li-1 { /* each list item gets the numbered class */
padding: 0 0 1em 2em;
background: url(../art/no-1.gif) no-repeat left top;
margin-top: 1em;
}

The HTML:
<ul class="numb-list"> <li class="li-2"><strong>If you decide not to tell the truth, don’t pretend you’re not allowed to. </strong>

<p>Often you’re entitled to release the information.... blah blah blah .... true, there’s no easy way to rebut the false bits without confirming the true ones, and on balance you end up deciding to keep mum. </p>

<p>Okay, that wouldn’t be my call but I’m not in your shoes. But at least you shouldn’t pretend (even to yourself) that it wasn’t your choice.</p></li>
SnowTao is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-19-2008, 04:02 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use a definition list (which is what it is really).

float your graphic number left in the <dt> and use <dd>s instead of paragraphs

http://www.candsdesign.co.uk/reference/html/tags/lists/
http://www.w3schools.com/html/html_lists.asp
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-20-2008, 01:54 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
Technically, you wouldn't have to have an extra <p> tag around the text inside of an <li>. The <li> tag itself encloses the items in a list. However, you are using a list a little differently. I agree with Chris that a definition list might be more suitable for this.
You could also use a list inside of a list.
The structure would be:
Code:
<ul class="numb-list">
 
   <li class="li-2">

      <ul>

          <li>
              <strong>If you decide not to tell the truth, don’t pretend you’re not allowed to. </strong>
          </li>

          <li>
              Often you’re entitled to release the information.... blah blah blah .... true, there’s no easy way to rebut the false bits without confirming the true ones, and on balance you end up deciding to keep mum. 
          </li>

          <li>
             Okay, that wouldn’t be my call but I’m not in your shoes. But at least you shouldn’t pretend (even to yourself) that it wasn’t your choice.
          </li>

       </ul>

    </li>

</ul>
__________________

Please login or register to view this content. Registration is FREE
angele803 is offline
Reply With Quote
View Public Profile
 
Old 08-20-2008, 07:58 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
SnowTao's Avatar
Average Talker

Posts: 24
Name: Elenor
Location: Cumming, GA
Trades: 0
chrishirst -- Thanks, I understand what you're suggesting -- but the thought of having to to redo a couple hundred such lists is daunting, to say the least! And I'm not sure it's accurate or better semantically to call text paragraphs definitions.

angele803 -- Thanks for your suggestion, however, I wouldn't want to turn what are actual paragraphs of text into list items -- because they are not in any way list items -- they're plain-old paragraphs that happen to be within a list. And I'd have to code the new "list items" to look like paras, and I'm not sure that's good coding.

I was thinking I could use "first-child" except MSIE doesn't handle that well (and sadly, huge, huge numbers of our visitors use MSIE).

I tried reading the W3C standard about <li>s and <p>s and it was no help. Does anyone know if it's a really bad thing to have the first "paragraph" of a <li> without a "close-code" of any kind? Or am I really compelled to turn it all into stuff it isn't actually?

Elenor
SnowTao is offline
Reply With Quote
View Public Profile
 
Old 08-20-2008, 10:25 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
I think I see your point now.

You might be able to do this with some javascript and the DOM. I am by no means a javascript or DOM expert, but you should be able to pick out all of the <ul> with a class of numb-list. Then you should be able to identify the first paragraph inside each of those classes. Then, with javascript, you should be able to dynamically add a class or a style to all of those first paragraphs.

I am not really sure where to point you from here (especially right now since it has been a long day of a long week and my brain is exhausted!!), but maybe it gives you something to work from? Maybe someone else can elaborate? If I get some time tomorrow, I will see if I can find an example or a tutorial that can help. I am pretty sure this can be done though.
__________________

Please login or register to view this content. Registration is FREE
angele803 is offline
Reply With Quote
View Public Profile
 
Old 08-20-2008, 11:46 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
So far as I am aware, you should not put a <p> inside a <ul>, ever; it's not semantically correct. You can change the <ul>s to <div>s and restyle accordingly; perhaps that would be easier?

tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 08-27-2008, 09:06 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
SnowTao's Avatar
Average Talker

Posts: 24
Name: Elenor
Location: Cumming, GA
Trades: 0
Thanks Tim ({sigh, I think}, that's kinda what I was afraid of: not having <p>s inside <li>'s...

So, <li>s can only ever be a single line or a single paragraph/block of text?
SnowTao is offline
Reply With Quote
View Public Profile
 
Old 08-27-2008, 11:26 PM Re: Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
A <li> must be enclosed by a <ul>, but it can have inline elements within it. Suckerfish menus, for instance, put anchor tags within the <li>, and use CSS (and sometimes javascript) to toggle whether it displays. What's important is that your markup is consistent and standards-compliant, which will make it much easier to style it to look the way you want it to.

Chris is right that a <dl> is probably your best bet, but again, you do have the option of changing to <div>s and keeping the <p>s.

tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Reply     « Reply to Using <P> inside <li>? (breaks in MSIE7, okay in MSIE6 and Firefox)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.45190 seconds with 12 queries