Now do that when you want the 8-th parent in a complex document.
css:
div:has( > \* > \* > \* > \* > \* > \* > \* > #the-child)
(backslashes added by hn because of formatting conflict)
xpath: //div[@id="the-child"]/../../../../../../../..