(Html) Width="" Height="" or (CSS) Width: Height:

Discussion in 'HTML & Website Design' started by AnonymousUser, Sep 25, 2008.

  1. #1
    Hey guys, Basically im wondering Which would be the better to do for a large amount of images asigned to one class.
    I know that by doing it by css technically the size of text formating would be smaller so the page should load faster, But then by doing it with html your page will load without waiting for your images to load because it allocates the space they need from the width="" and height="" tags

    Does anybody know wether it works the same way in css? Does the page allocate space for the images then continue to load the rest of the page without waiting for the images?
    Please only answer if your 99% sure.

    Thanks in advance
     
    AnonymousUser, Sep 25, 2008 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Certain elements have dimensions that are implicit. Width is implicit in table, img, and object. Height is implicit to img and object. (No other use of the attributes are valid.)

    You are correct that setting these attributes may speed the rendering of the page, as the layout space may be reserved prior to getting the other files. (Tables are another pile of issues, but setting the width will often help.)

    The stylesheet is applied only after the document object model has been built by the UA. The UA walks the DOM (see attached X-window dump) and searches the stylesheets for applicable rules for each node. But, then the page isn't usually rendered until the stylesheet is read and applied, anyway.

    There may be some small advantage to using the html attributes; they should probably be used for structural reasons (I always try to use them), but I doubt the rendering speed difference is particularly noticeable unless neither attributes nor style rules are used.

    cheers,

    gary
     

    Attached Files:

    • dom.png
      dom.png
      File size:
      35.6 KB
      Views:
      70
    kk5st, Sep 25, 2008 IP
    AnonymousUser likes this.
  3. AnonymousUser

    AnonymousUser Peon

    Messages:
    593
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok cool, Thanks for your input.
    Rep added
     
    AnonymousUser, Sep 25, 2008 IP