Nesting and Structure
ã¡ãã¥ãŒã衚瀺ããã«ã¯ã¹ã¯ã€ãããŠãã ãã
When building a web page, how you nest semantic layout elements affects both the clarity of your code and the accessibility of your content. Proper nesting means placing elements within each other in a way that reflects the logical structure of your page. For example, your main content should be inside the main element, and distinct sections of content belong in section elements. If you have a news article, that might go inside an article element, which itself could be nested within a section. Related content that is not the main focusâsuch as a sidebarâshould be placed in an aside.
Here are some common patterns for nesting semantic layout elements:
- Place only one
mainelement per page, and do not nest it insideheader,footer,article, orsectionelements; - Use
sectionelements to group related content withinmainor within anarticle; - Nest
articleelements insidesectionwhen you have multiple, self-contained pieces of content within a section; - Use
asidefor tangentially related content, such as tips, links, or sidebars, and place it withinmain,article, or evensectionas appropriate; - Avoid placing
headerorfooterelements directly insideasideunless the aside itself represents a complete, standalone section.
Note
A common mistake is to nest
mainelements inside each other, or to putmaininside aheaderorfooter. Another error is to usesectionorarticleelements without a clear reasonâuse them only when the content has its own heading or could stand on its own.
index.html
ãã£ãŒãããã¯ããããšãããããŸãïŒ
AIã«è³ªåãã
AIã«è³ªåãã
äœã§ã質åããããææ¡ããã質åã®1ã€ã詊ããŠãã£ãããå§ããŠãã ãã