网页开发层次
引入本课内容
| English | 释义 | 拼音 |
|---|---|---|
| content layer | 内容层 | nèi róng céng |
| presentation layer | 表现层 | biǎo xiàn céng |
| border/ˈbɔːdə/ | 边框 | biān kuàng |
| external stylesheet | 外部样式表 | wài bù yàng shì biǎo |
| behaviour layer | 行为层 | xíng wéi céng |
| scripting language | 脚本语言 | jiǎo běn yǔ yán |
Three jobs, three languages
- A web page is built in three layers: what it says, how it looks, and how it responds.
Content layer 内容层
- Enters the content and creates the structure: headings, paragraphs, tables, images, links.
- Language: HTML, e.g.
<h1>Opening times</h1>.
Match each layer to its language.
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Structure, look, action.
Presentation layer 表现层
- Displays and formats elements: colours, fonts, sizes, borders 边框, layout.
- Language: CSS, e.g.
h1 {color: navy;}. One external stylesheet 外部样式表 can restyle many pages.
Match each part of a web page to its layer.
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
What it is, how it looks, what it does.
Changing a shared external stylesheet changes the look of every page that uses it.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
The content does not need to be touched.
Which is a job of the behaviour layer?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Behaviour responds to the user.
Why separate content from presentation?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
One content layer, many presentations.
Behaviour layer 行为层
- A scripting language 脚本语言 such as JavaScript makes the page respond: pop-ups, slideshows, form checks.
Term-dates table: the table and dates are content (HTML); the blue header and borders are presentation (CSS); a button highlighting today is behaviour (script).
Colours and fonts are not content. Anything about appearance belongs in the presentation layer.
Content = HTML structure; presentation = CSS formatting; behaviour = scripts responding to users. Separating them lets one stylesheet restyle many pages and devices.
出了什么问题?只有网站团队能看到这些信息。