'wrap' inconsistency? createElement VS document.write

  • Thread starter Pieter Van Waeyenberge
  • Start date
P

Pieter Van Waeyenberge

Hello,

im some image elements using doc.createElement('IMG');
i set the following styles:
- for the images container: white-space:normal;
- for the images themselves: display: inline;

i append the images to the body ... but the imagery dont wrap when the
window gets smaller, unless i append a space (createTextNode) after each
image

HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
src="" ...> it wraps fine


Is this normal??

Pieter
 
M

Martin Honnen

Pieter Van Waeyenberge wrote:

im some image elements using doc.createElement('IMG');
i set the following styles:
- for the images container: white-space:normal;
- for the images themselves: display: inline;

i append the images to the body ... but the imagery dont wrap when the
window gets smaller, unless i append a space (createTextNode) after each
image

HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
src="" ...> it wraps fine


Is this normal??

Write a small test case demonstrating the problem, post a URL and tell
us which browser(s) exhibit the problem. Then someone can better give an
opinion on why that occurs or shouldn't occur.
 
P

Pieter Van Waeyenberge

sorry, some more detail:
(i dont have URL handy and the whole script is too complex to post it here)

i only tested on most recent NS & IE, and the code behaves the same ...

SCENARIO 1: images do NOT wrap
--------------------------------------
<script>
onload = function(){
var foo = document.createElement('IMG');
foo.src = 'foo.jpg';

var goo = document.createElement('IMG');
goo.src = 'goo.jpg';

var myBody = document.getElementsByName('BODY');
myBody = myBody.item(0);

myBody.appendChild(foo);
myBody.appendChild(goo);
}
</script>
<body>
</body>

SCENARIO 2: images wrap
--------------------------------------
<body>
<img src="foo"><img src="goo">
</body>

Remark: i also tried putting the images of SCENARIO 1 in a container with
'white-space:normal;' and the images themselves 'display:inline;' ... still
no wrapping when flow should go to next line, instead i get scrollbar and
all on one line ... unlike in SCENARIO 2

However, in SCENARIO 1, i obtain wrapping when i explicitly add some
white-space after every image ... sounds logical, but in SCENARIO 2 theres
no whtespace between the images so i find it inconsistent?

I hope this is more clear ....
Pieter.
 
P

Pieter Van Waeyenberge

ignore this thread .. i didnt set whitespace = normal explicitly in the
containing elemnt

pieter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top