html - Center tag works fine, but align attribute doesn't! What may be the issue? -


i trying align complete page, center of frame, , if use center tag, works fine. but, if use

<body align=center> 

or

<body style="align:center"> 

it doesn't align page, keep left-aligned default. now, newbie @ html honest, don't have idea, may causing this. also, happens in non-ie browsers. ie shows page center aligned, without tags.

although, not of significance, can use center tag, nice know why align attribute doesn't work. kindly let me know, if got idea, problem.

edit:

turns out, because of quirks mode. david , town! :d

<body align=center>

don't use this. align attribute deprecated.

<body style="align:center">

css preferred method but:

  • inline style (the use of style attribute) should avoided in favour of real stylesheets.
  • there no align property in css

use text-align property if want centre inline content of element apply or set left , right margins auto centre block elements. more details, , diagrams, see centring using css.

also, happens in non-ie browsers. ie shows page center aligned, without tags.

if don't have doctype triggers standards mode, browsers emulate bugs in earlier browsers (quirks mode). should avoid makes things less consistent.

one of these bugs internet explorer centre block elements if ancestor has text-align: center set (and won't support auto margins).


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -