Solution 要做什麼
對照完整答案、責任邊界與原因。
本主題檔案:files/style.css
定位:在 Elements 選取 data-inheritance-child,先讀 Computed color 與 border-top-width。
Solution · code-edit
對照完整答案、責任邊界與原因。
對照完整答案、責任邊界與原因。
本主題檔案:files/style.css
定位:在 Elements 選取 data-inheritance-child,先讀 Computed color 與 border-top-width。
頁面不會替你修改檔案;請在實作檔完成後重新整理確認。
父層 color 為 rgb(23, 50, 77)、border 為 4px;子層沒有 border-width 宣告。
子層 color 與父層相同;border-top-width 初始為 0px,加入明確 inherit 後才成為 4px。
.parent { color: #17324d; border: 4px solid; } .child { border-width: inherit; }只在本階段資料夾內操作,避免改到其他章節。
index.htmlstyle.css證據:實驗 before=0px、after=4px;同一子層的 Computed color 與父層相同
回到主題說明