Results 1 to 2 of 2

Thread: What's best practice when placing an image within a page - dimentions or not?

  1. #1
    Join Date
    Jan 2006
    Location
    Derbyshire, UK
    Posts
    74
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default What's best practice when placing an image within a page - dimentions or not?

    I've notice that some coders when pacing an image on a page use...
    Code:
    <img src="assets/images/image.png">
    and others use...
    Code:
    <img src="assets/images/image.png" width="200px" height="100px">
    Both apper to display the image the same but what's the benefits of the dimensions?

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    So the browser can allocate the space in advance of image download.

    We don't notice the effect so much now with fast broadband speeds but dialups see the page chucking text around as images push themselves into place when dimensions arnt set, which is very distracting and confusing.

    When dimension are there the browser allocates placeholders for the images to download at their leisure and text appears in the correct place from the start. Its better practise to include them.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •