Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPatrick Mangan
6,444 PointsImage size vs. default html page size
Hey everybody,
I'm guessing this will be answered in later videos, but I wanted to ask before I forget...
I'm trying to attach my own images in the Objects section of HTML Deep Dive, rather than just the flower picture in the project files. I've copied my own images into the correct file directory, named them properly, and inserted them into an <img> element. The flower picture loads fine, but my pictures result in a broken image icon in google chrome.
I'm assuming that because my pictures are high resolution, they are conflicting with the default html page size. Am I right? If so, is there a way to remedy this in html or do you have to use CSS?
Thanks guys!
2 Answers
Stephen Snowder
3,932 PointsIt would be helpful if you could add the code. I've only changed image sizes in CSS, and I think that will be the much easier answer for you generally, because it will keep you from having to constantly go in and change each image one by one whenever you want to do it, but it is possible to do it in html. Here's the code:
<img src="flower.jpg" height="60" width="60">
You can change the dimensions to whatever you want. I'm not sure why the size of the image would be a problem though. Is your image in the same folder that your html page is? If not, don't forget you have to provide the directory. If this doesn't solve your issue, provide the code and I'll take another look.
(Disclaimer: I am also a noob at this, so my answer may not be helpful!)
Patrick Mangan
6,444 PointsStephen,
I got it to work. I still have no idea why it wasn't working before, but I really appreciate you trying to help.
Thanks!