views:

30

answers:

2

How do you get Internet Explorer 6 and 7 to not literally interpret whitespace and line breaks in HTML list items? In the image below, I have marked the undesired whitespace in red. I would prefer to not squeeze everything into one giant line of code. It's very hard to read that way. Is there a CSS alternative?

http://img834.imageshack.us/img834/8583/listdu.png

<ol>
 <li>
  <img>
  Sentence 1
  Sentence 2
 </li>
 <li>
  <img>
  sentence
 </li>
 <li>
  sentence
 </li>
</ol>
+1  A: 

Use a different browser? haha, but in all seriousness, i would suggest just formatting your code to show it properly. Perhaps encapsulating the sentances in spans could do it

<ol>
 <li>
  <img>
  <span>Sentence 1</span>
  <span>Sentence 2</span>
 </li>
 <li>
  <img>
  <span>sentence</span>
 </li>
 <li>
  <span>sentence</span>
 </li>
</ol>
Ascherer
How would wrapping text in spans have any effect on the page rendering?
Tomalak
its IE, why would whitespace do that in the first place..., it could ignore the whitespace infront because of the span tags now. Im not sure, i havent tried it
Ascherer
This did not fix it.
JoJo
could we get the css that you are using too?
Ascherer
+2  A: 

Here is some useful information Closing gaps in ie

methodin
This screwed up my site. I have many display:none spans containing other language translations. The act of adding display:inline-block made all 20 languages appear at once.
JoJo
Add an id to the ol <ol id="myid">... and change the styles to start with #myid. You generally don't want to apply changes like this to ALL elements.
methodin