Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS image resizing CSS vs. jQuery

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31451

    Hi all,

    I have a general question about simple image resizing that retains the aspect ration of the image(s).

    Is it good practice to use CSS for resizing images (e.g. with “div.example img (width: 300px;)”) or should I choose a simple jquery script for that matter?

    I noticed that by either only setting the width or height of an image with CSS, the aspect ratio is kept the same as in the original image.

    There is no need to post any jquery code, because I already have a working script at hand. It’s just that I am interested, if there are any performance issues when using the CSS method.

    Many thanks in advance for your thoughts!

    Kind regards,

    Alex

    #63140
    TT_Mark
    Member

    You shouldn’t really be doing either as the browser still has to load the full image in before it resizes it.

    You should resize the image before adding it to your website

    #63142
    burtflaxton
    Participant

    ^ Also be sure and set the actual height/width of the image so that the page does not jump around when hanging trying to load images.

    #61976

    many thanks for your comments. I am aware that I should always set the actual width and height of an image, but as this particular section is where a user can upload his own pictures, I would like to resize this image to a predefined width and the corresponding height. normally a PHP script like Timthumb would come in handy, but this is for a Tumblr theme and PHP is unfortunately not an option.

    Thanks again for your advice!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.