javascript - innerHTML alignment question -
i have js code brings in random images , text (captions). captions centered under images , them left aligned -- can tell me how might edit
span.innerhtml =shuffled[i].text;
to make text left aligned under image? in advance if can answer it!
{ var td = document.getelementbyid("title"+i); var link = td.getelementsbytagname("a")[0]; var image = link.getelementsbytagname("img")[0]; var span = link.getelementsbytagname("span")[0]; image.src = ibase + shuffled[i].image; link.href = urlbase + shuffled[i].href; span.innerhtml =shuffled[i].text; image.alt = shuffled[i].text; }
there's nothing in javascript centering text. looks existing stylesheet rule might doing this. if can edit css, i'd recommend approach first. if not, try adding this:
span.style.textalign = "left";
i'm assuming span contains text you're trying align left.
Comments
Post a Comment