html元素添加⼩标题_HTML标题和标题元素
html 元素添加⼩标题
The <head> element contains information about an HTML page, while the <body> contains elements that the user reads, views, and interacts with.
<head>元素包含有关 HTML页⾯的信息,⽽<body>包含⽤户阅读,查看并与之交互的元素。
There is only ever one <head> element on a page, and it is usually the first tag immediately inside the <html> element. Elements inside the <head> do not appear in the browser window under normal circumstances.
页⾯上只有⼀个<head>元素,通常是紧靠<html>元素内的第⼀个标签。 在正常情况下, <head>元素不会出现在浏览器窗⼝中。
标题 (title)
The <title> describes the primary purpose of the page. It exists nowhere else but inside the <head>. It should be the first thing you define in the document, after the has been created.
<title>描述页⾯的主要⽬的 。 它只存在于<head>内部。 创建的之后,这应该是您在⽂档中定义的第⼀件事。
<head>
<title>Dudley Storey’s Home Page</title>
</head>html网页设计的标题
The <title> is used in several different contexts. It appears in:
<title>在⼏种不同的上下⽂中使⽤。 它出现在:
1. The browser tab, next to the
旁边的浏览器选项卡
2. The primary link text for
的主要链接⽂字
3. Browser bookmarks
浏览器书签
4.
Always make the title full, unique and descriptive. When making a web page for a company, include the company name and the subject of the page itself in the <title>:
始终使标题完整,独特且具有描述性 。 为公司制作⽹页时,请在<title>包括公司名称和页⾯本⾝的主题:
<title>Immortan Joe's Car Shop – Vehicles for Sale</title>
Alternatively, the subject of the page can go first:
另外,页⾯的主题可以排在第⼀位:
<title>Vehicles for Sale – Immortan Joe's Car Shop</title>
The separator between the page subject and the site name in the title doesn‘t matter: em-dashes (–) and pipes (|) are both common.
页⾯主题和标题中的站点名称之间的分隔符⽆关紧要:破折号( – )和管道( | )都很常见。
If you don‘t use the site name in the title, at least provide a context: ”Dudley Storey‘s Hobbies” is much more informative than “My Hobbies”; “Products | Running Shoes” is better than “Products” or “Shoes”
如果您在标题中未使⽤⽹站名称,请⾄少提供⼀个上下⽂:“ Dudley Storey的兴趣爱好”⽐“我的兴趣爱好”提供更多信息; “产品| 跑鞋”优于“产品”或“鞋”
The title may also relate to the filename of the HTML page, but it doesn‘t have to.
标题也可能与HTML页⾯的⽂件名有关,但不是必须的。
The reason <title> should be created first is that most people are understandably eager to add content or a design, and tend to leave the <title> as an afterthought… or forget it entirely. By specifying it first, you set forth the purpose of the page.
应该⾸先创建<title>的原因是,可以理解,⼤多数⼈都渴望添加内容或设计,并且倾向于将<title>留作事后思考……或完全忘记它。 通过⾸先指定它,您可以阐明页⾯的⽤途 。
动动脑筋 (Use Your Head)
The <head> is used for many other purposes. At a minimum, it should include the following , written before the title:
<head>⽤于许多其他⽬的。 ⾄少应包括以下 ,该位于标题之前 :
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
…
</head>
The meta tags, in order:
元标记,顺序为:
1. Set for the document
设置⽂档的
2. Set correct scaling of the page on mobile devices
在移动设备上设置页⾯的正确缩放
Optionally, if you are aiming to support Internet Explorer before version 11, include the following in the <head>:
(可选)如果您打算⽀持版本11之前的Internet Explorer,请在<head>添加以下内容:
<meta http-equiv="x-ua-compatible" content="ie=edge">
…which forces IE versions 9 and 10 to modern web standards (at least, the standards they were capable of when they were made).
…这迫使IE版本9和10达到现代Web标准(⾄少是它们在制作时能够使⽤的标准)。
头部元素的传统⽤法 (Traditional Uses of The Head Element)
Traditionally, the <head> has also contained links to and :
传统上, <head>也包含指向和链接:
<head>
…
<link rel="stylesheet" href="styles.css">
<script src="page.js"><script>
</head>
Additionally, or alternatively, it could include embedded stylesheets or scripts:
另外,或者替代地,它可以包括嵌⼊式样式表或脚本:
<head>
…
<style>
// CSS here
</style>
<script>
// JavaScript here
</script>
</head>
However, HTML5 does not require these elements to appear in the <head>. Today, they are frequently relocated lower down on the page, inside or below the <body>. This is done to reduce blocking.
但是,HTML5 不需要这些元素出现在<head> 。 如今,它们经常在页⾯的下⽅, <body>内或下⽅重新定位。 这样做是为了减少阻塞 。头块 (Head-Block)
Since pages are read and interpreted by a browser from the top down, lengthy scripts or styles in the <head> can slow down or page rendering. By moving these elements below the <body>, the page can, in principle, render faster.
由于浏览器会⾃上⽽下地读取和解释页⾯,因此<head>冗长的脚本或样式可能会减慢或页⾯呈现。 通过移动下⾯这些元素<body>页⾯可以在原则上,呈现速度就越快。
For basic web pages, keeping styles in the <head> is still a good idea; placing scripts at the bottom of the page is a best practice.
对于基本⽹页,将样式保留在<head>中仍然是⼀个好主意。 最佳做法是在页⾯底部放置脚本。
In more advanced web development, the scripts and styles may be located both in the <head>and lower down on the page, with code that influences the look of the page “above the fold” - that is, the portion of the page that the user initially sees when it loads - left in the <head>, and the rest, affecting the remainder of the page, left lower down.
在更先进的⽹络开发中,脚本和样式可以在位于两者<head>降低了⽹页上,与代码影响在⽹页“上⾯的折”的外观-即,页⾯的该部分⽤户最初在加载时会看到-留在<head> ,其余部分会影响页⾯的其余部分,并从左下⽅向下看。
A minimal <head> section would therefore consist of:
因此,最⼩的<head>部分将包括:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Your Page Title Here</title>
</head>
Josh Buchea has an excellent of an HTML document. It should be emphasized that there’s no requirement that you put everything in this list in the <head>; it simply provides all the possibilities.
Josh Buchea HTML⽂档中了⾮常不错内容。 应该强调的是,不要求您将所有内容都放在此列表的<head> ; 它只是提供了所有可能性。
html 元素添加⼩标题
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论