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!
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 trial
Abhishek NeogiFront End Web Development Techdegree Student 995 Points
Does <div> not affect the original image sizes?
Is div used only as an overall styling element (affects all in general but not individual everyone's properties) ?
Like you know, reducing everyone's HP in an enemy party but not specifically changing their statuses to poison/frozen etc.
Also, I am talking about a <div> when identified with an id attribute in this case.
Amrit Pandey17,595 Points
For example we say that:
- You just created a division and kept your image in it.
<div> <img src="your-image.jpg"> </div>
So let us say that the width of your image size is 800px and you did not assign any value to the width of your div.
By default, the width of a <div> is 350px, but when you will view your code in browser you will have an image of width 800px displayed despite of the fact that your image is in a div container of width 350px.
Hence the answer to your question is NO, the div does not affect your image. To bring effect, you have to set the properties of your image to inherits the property of its parent tags in which in this case is a div tag.