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
sonat ugur
5,725 Pointsabout image's parent
"Images set to max-width:100% will fill their parent element" I wonder the meaning of the parent phrase of image.
1 Answer
Jonathan Grieve
Treehouse Moderator 91,254 PointsHi there Sonat.
When we talked about "parents" in HTML this refers to the preceding element in the document tree.
<html>
<body>
<h1>Page Title</h1>
<p>
<img src ="" />
</p>
</body>
A HTML document is made up of HTML elements which are organised like branches of a tree. Elements are "parents" and "children" of each other because they precede each other or come after each other.
In this example above,
<html> is the root elememt of the document because it is the first element to appear in the document; the element in which all others are contained.
<body is a child of html but a parent of <h1> because it is the second element in the tree.
<img> is a child of the paragraph element which is a sibling of h1 but a child of body.
Hope this helps :)
sonat ugur
5,725 Pointssonat ugur
5,725 PointsThis helps so much thanks:)