[thelist] Styling JavaScript created paragraph

Julian Rickards julian.rickards at gmail.com
Sun Oct 22 14:20:14 CDT 2006


If the JS code is:

  var para = document.createElement("p");
  para.setAttribute("id","description");

doesn't this generate (thanks) a paragraph with the id of description and
should I be able to style it in the stylesheet?

Like I said, I may have messed with something else but if I am correct
above, then I can search for whatever else I may have messed up.

Jules

On 22/10/06, Christian Heilmann <codepo8 at gmail.com> wrote:
>
>
> There is no difference between Paragraphs and generated Paragraphs.
> Both the set Attribute lines are invalid. If you want to do that in JS
> you need to set
> document.getElementById('description').style.textAlign='center';.
> However, only MSIE6 centers images with the text flow. If you want to
> do it in other browsers, use margin:0 auto; and display:block to
> center an image.



More information about the thelist mailing list