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
34 Answers
+ 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
+ 2
Or you can just use JavaScript to change its size, target it with JS using its Id then set the width and height
+ 2
ah i meant just get the screenshot and save it either to Dropbox or Google drive and share the link
+ 1
img{
width:20px;
height:30px;
}
+ 1
show your code
+ 1
have u gone crazy? why dont u just the code for better understanding..
+ 1
He means post on the code you're working on
+ 1
are u coding in this app
+ 1
ok can u just take the screenshot of ur html and css codes and insert it here
+ 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?
+ 1
are u able to see the image in the browser?
+ 1
thank you so much for you help
+ 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
0
i understand that but ive been putting width and height in css but it doesnt seem to be changing the size
0
just tryed that and it doesnt seem to be changin when i refresh the page
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.
0
i think the body tag in css is changing it and not the img tag
0
but even then its not making it any bigger just the alignment is changin
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.
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;
}