0

Is it possible to resize an image in css?

as you can probably tell im new to this but i am making a website in my spare time so i can get the basics of html and css. I have an img in my html code and the css doesnt seem to be changing the height or the width of the img. and im wondering where im goin wrong any help would be appreciated

20th Jul 2017, 6:57 PM
ELITEDJJ
ELITEDJJ - avatar
34 Respuestas
+ 2
<img src="source" width="width" height="height"> where source is the source of the image, width is the image width on the x axis and height is the height on the y axis
20th Jul 2017, 7:24 PM
LordGhostX
LordGhostX - avatar
+ 2
Or you can just use JavaScript to change its size, target it with JS using its Id then set the width and height
20th Jul 2017, 10:16 PM
LordGhostX
LordGhostX - avatar
+ 2
ah i meant just get the screenshot and save it either to Dropbox or Google drive and share the link
21st Jul 2017, 11:19 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
img{ width:20px; height:30px; }
20th Jul 2017, 7:59 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
show your code
20th Jul 2017, 8:22 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
have u gone crazy? why dont u just the code for better understanding..
20th Jul 2017, 11:23 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
He means post on the code you're working on
20th Jul 2017, 11:31 PM
LordGhostX
LordGhostX - avatar
+ 1
are u coding in this app
21st Jul 2017, 6:37 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
ok can u just take the screenshot of ur html and css codes and insert it here
21st Jul 2017, 10:10 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
first of all in html.. close the body tag after the img tag and then close the html tag.. it should be like this.. <!DOCTYPE html> <html> <head> <title>Call Of Duty</title> <link tel="stylesheet" href="style.css"> </head> <body> <img src="Call_of_duty.jpeg" alt="Call Of Duty"> </body> </html> and if u have saved the style.css file in the same place where the Html file is saved then now it should work.. and one more thing are you able to see the image in the browser?
21st Jul 2017, 11:31 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
are u able to see the image in the browser?
21st Jul 2017, 11:41 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
thank you so much for you help
21st Jul 2017, 11:42 AM
ELITEDJJ
ELITEDJJ - avatar
+ 1
np ;) hereafter if u face any problem so please copy your codes to the code Playground and then insert it to the question.. (u have an insert button in the bottom left corner) it would be easy to help by seeing the code
21st Jul 2017, 11:45 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
i understand that but ive been putting width and height in css but it doesnt seem to be changing the size
20th Jul 2017, 7:37 PM
ELITEDJJ
ELITEDJJ - avatar
0
just tryed that and it doesnt seem to be changin when i refresh the page
20th Jul 2017, 8:15 PM
ELITEDJJ
ELITEDJJ - avatar
0
Perhaps another part of your code is overriding the style (ie you are trying to style it twice). Otherwise your syntax, or the link to your stylesheet may have an error.
20th Jul 2017, 9:09 PM
James
James - avatar
0
i think the body tag in css is changing it and not the img tag
20th Jul 2017, 9:14 PM
ELITEDJJ
ELITEDJJ - avatar
0
but even then its not making it any bigger just the alignment is changin
20th Jul 2017, 9:16 PM
ELITEDJJ
ELITEDJJ - avatar
0
body{ background black width 50px height 50px text-align center } whats strange is if i add the width and height the alignment of the image is top left but if i remove them it centers the image.
20th Jul 2017, 9:21 PM
ELITEDJJ
ELITEDJJ - avatar
0
You need colons : and semicolons ; in your CSS code. Also, to make a background, use background-color. And I wouldn't go changing the height and width of the body--why are you trying to? body{ background-color: black; text-align: center; } img{ width: 50px; height: 50px; }
20th Jul 2017, 9:29 PM
James
James - avatar