Resizing images using javascript before assigning them an img tag

I am very new to developing HTML and CSS.

I have an HTML page with a tag img. This tag will contain some images. These images have different sizes. I set the width and height of the tag imgusing CSS.

All images will be displayed using JavaScript.

Maybe I need to resize images using JavaScript before assigning an image to a tag img? Maybe I don’t need to do this because I set the size imgusing CSS. Proportions will be limited?

Sorry for my English.

+5
source share
2

, , css. - html img, .

+3

. script. , HTML/CSS.

. , , ( ), , . , .

, , , 640x480, :

HTML:

<div id="wrapper"><img src="my.jpg"></div>

CSS

#wrapper {
    width: 640px;
    height: 480px;
    line-height: 480px;
}

#wrapper img {
    width: 640px;
}
+3

All Articles