You shouldn't have to do anything. You would normally serve the same `ErrorDocument` regardless of what URL caused the error. In your case, you are serving `/404.html` in the document root of your site.

However, it sounds as if you are using _relative_ URLs to your static resources inside your error document. This is never going to work (unless you [set a `base` tag][basetag] - but this is not without its caveats - see _reference link_ below) since the error document could be served from anywhere and so the _browser_ will resolve your relative URLs incorrectly (or at least, not as you intended). Instead, you need to use root-relative URLs (starting with a slash, as you have done for `/404.html`) or absolute URLs (including scheme + hostname).

> when I access `example.com/parent/nonexistentpage.html`, although the URL doesn't change, I get a generic, unstyled 404 error message

Assuming your `ErrorDocument` directive is still set to serve `/404.html` and you are using relative paths in `/404.html`, then any relative URL-paths will naturally resolve relative to the `/parent` "directory", not the document root, as it would otherwise do if requesting `example.com/nonexistentpage.html`.

Remember it is the _browser_ that resolves relative URLs, based on the URL being requested. This has nothing to do with the filesystem path on your server.

See this other related question for additional examples and discussion about the use of the `base` tag:

 - https://webmasters.stackexchange.com/questions/86450/htaccess-rewrite-url-leads-to-missing-css

 [basetag]: https://webmasters.stackexchange.com/a/86458/1243 "Using root-relative paths or set the BASE tag"