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 trialAbhishek Neogi
Front End Web Development Techdegree Student 995 PointsDoes <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.
1 Answer
Amrit Pandey
17,595 PointsFor 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.