0

document.body.setAttribute('align', 'center') works in Chrome and Edge, not Firefox.

I have tried every variation and alternative I can think of to center a whole page or document (loaded in an iFrame) that is generated by Javascript. Does anyone have any other suggestions?

Thanks!


Edit for clarification: I have a dynamically-produced select menu, instructions and a pic that I'd like to wrap in javascript <center> tags. So much so, I even tried wrapping an external script in the old, deprecated html tag.

  • @abgregs - I added another paragraph about what I'm trying to do. The code example from my initial post works in Chrome and Edge, both in and out of my frame, but everything is shoved left in Firefox. I've tried... maybe 30 different ways and nothing seems to work in my updated Firefox 104.0.2. There has to be some magic phrase. (Thanks for the reply) – OldJavascriptGuy Sep 13 '22 at 07:24
  • There are better ways to center an element using CSS. `
    ` is deprecated, so is `align="center"`
    – Terry Sep 13 '22 at 07:55

0 Answers0