2.3.9: Nested Views Codehs
The exercise specifically tests your ability to create a hierarchy where the position of a child view is relative to its parent , not the entire screen.
<!-- Simple HTML structure with nested views --> <!DOCTYPE html> <html> <head> <title>Nested Views Example</title> <link rel="stylesheet" href="style.css"> </head> <body> <!-- Header View --> <header> <h1>Main Header</h1> </header>
A: Yes! CodeHS allows unlimited nesting (e.g., Tab > Panel > Group > Button ). However, for 2.3.9, two levels (parent + direct children) are sufficient. 2.3.9 nested views codehs
@Component( selector: 'app-sidebar', template: '<aside>Sidebar content</aside>' ) export class SidebarComponent {} // app.component.ts import Component from '@angular/core';
Many CodeHS graphics libraries do automatically offset child coordinates. If you set avatar.setPosition(10, 10) and the parent is at (100, 100) , the avatar might appear at (10, 10) on the screen (overlapping the parent's corner) or at (110, 110) . The exercise specifically tests your ability to create
: Always close your tags! A self-closing tag looks like .
Option A: Relative Positioning (Modern UI libraries) However, for 2
/* Content goes here */ Use code with caution. Why Use Nesting?