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 trial

HTML How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

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.

1 Answer

Amrit Pandey
Amrit Pandey
17,595 Points

For example we say that:

  1. You just created a division and kept your image in it.

<div> <img src="your-image.jpg"> </div>

  1. 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.

  2. 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.

  3. 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.