Home > Web Front-end > HTML Tutorial > Useful HTML tags you might ignore (summary)

Useful HTML tags you might ignore (summary)

青灯夜游
Release: 2021-02-13 08:59:56
forward
2922 people have browsed it

Useful HTML tags you might ignore (summary)

Recommended: html tutorial

With the increasing reliance on JavaScript frameworks and libraries, many people pay less attention to HTML. . This results in us not being able to take full advantage of many features of HTML, which can greatly enhance website functionality. Also by writing semantic HTML you can add the correct context to your website content, significantly improving the user experience.

This article will introduce some useful HTML tags that you may have overlooked. The

<base>

<base> tag allows you to create a scenario where there is a base URL that acts as the Prefix for all relative URLs. The tag must have a href or target attribute that contains the base URL, or both.

<!DOCTYPE html>
<html>
<head>
  <base href="https://www.google.com/" target="_blank">
</head>
<body>

<h1>The base element(Google As a case study)</h1>

<p> <a href="gmail">Gmail</a> - Used to send emails; which are messages distributed by electronic means from one computer user to one or more recipients via a network.</p>

<p><a href="hangouts">Hangouts</a> - It&#39;s used for Messaging, Voice and Video Calls</p>
</body>
</html>
Copy after login

This way you don’t have to repeat the URL prefix for each request.

There can only be one <base> element in an HTML document, and it must be located within the <head> element.

Image map

Image map is an image with a specific clickable area and is defined through the map tag. These areas are set up using the <area> tag. This allows you to embed links in different parts of the image, which can lead to other pages, which is useful for describing what is in the image.

Look at an example:

The first step is to insert the image using the <img alt="Useful HTML tags you might ignore (summary)" > tag as usual, but this time using the usemap attribute .

<img src="study.jpg" alt="Workplace" usemap="#workmap">
Copy after login

Next create a <map> tag and use the same value as the usemap attribute in the img tag name attribute. This will link the <image> tag with the map tag.

  <map name="workmap">

  </map>
Copy after login

Then start creating clickable areas. We need to define how to draw each area, usually using shape and coords.

<area>

<map name="workmap">
  <area shape="rect" coords="255,119,634,373" alt="book" href="book.html">
</map>
Copy after login

Use the <area> element to define clickable areas on the image. It is added inside the map element.

These properties include:

  • shape is required when drawing a rectangle over the relevant area. You can use other shapes such as rectangle, circle, polygon or the default shape (whole image)
  • alt is used to specify when the area element is Alternate text to be displayed when rendering fails
  • href Contains a URL linking the clickable area to another page
  • coords using coordinates (starting with (in pixels) to cut out shapes accurately. You can use various software to obtain the exact coordinates of an image; Microsoft's drawing software is used below as a simple example. Different shapes represent their coordinates in different ways. For example, a rectangle is represented by left, top, right, bottom.

Here we have top, left Coordinates:

Useful HTML tags you might ignore (summary)

You can find the The lower left corner reads the coordinates of the cursor on the picture, or you can just use the ruler on the horizontal and vertical planes.

The screenshot below shows the right, bottom coordinates:

Useful HTML tags you might ignore (summary)

##The final result is:

<img src="study.jpg" alt="Workplace" usemap="#workmap">

<map name="workmap">
  <area shape="rect" coords="255,119,634,373" alt="book" href="book.html">
</map>
Copy after login

can also be used Other shapes, but the coordinates of each shape are written differently.

For

circle, there should be the coordinates of the center of the circle, and then add the radius:

<map name="workmap">
  <area shape="circle" coords="504,192,504" alt="clock" href="clock.html">
</map>
Copy after login

Useful HTML tags you might ignore (summary)

The coordinates of the center of the circle Agreeing to be located in the lower left corner, the horizontal distance from the center to the end of the circle is the radius.

Creating a

poly is more like drawing freehand. You just link different points on the image and they will be connected:

<map name="workmap">
  <area shape="poly" coords="154,506,168,477,252,429,187,388,235,332,321,310,394,322,465,347,504,402,510,469512,532,454,581,423,585,319,593,255,589,240,536" alt="clock" href="clock.html">
</map>
Copy after login

Useful HTML tags you might ignore (summary)

Here are the values ​​you need when creating a shape in HTML:

ShapeCoordinates##rectleft, top, right , bottomcirclecenter-x, center-y, radiuspolyx1, y1, x2, y2,….default

<abbr><dfn>

标签 <dfn> 指定要在父元素中定义的术语。它代表“定义元素”。标签 <dfn> 的父级包含术语的定义或解释,而术语位于 <dfn> 内部。可以这样添加:

<p><dfn title="HyperText Markup Language">HTML</dfn> 
  Is the standard markup language for creating web pages.
</p>
Copy after login

也可以与 <abbr> 结合使用:

<!DOCTYPE html>
<html>
<body>

<p><dfn><abbr title="HyperText Markup Language">HTML</abbr></dfn> 
  It&#39;s the standard markup language for creating web pages.</p>
</body>
</html>
Copy after login

这可以增强可访问性,因为这样编写语义 HTML 可以使阅读器和浏览器在适合用户的上下文中解释页面上的内容。

也可以单独使用 <abbr>

 <abbr title="Cascading Stylesheet">CSS</abbr>
Copy after login

<div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">&lt;/code&gt; 和 &lt;code&gt;&lt;code&gt;&lt;/code&gt;&lt;/h2&gt;&lt;p&gt;预格式化的文本或 &lt;code&gt;&lt;pre class=&quot;brush:php;toolbar:false&quot;&gt;&lt;/code&gt; 标签用于在编写文本时显示文本(通常是代码)。它显示所有空格和制表符,并完全按照块中的格式进行设置。&lt;/p&gt;&lt;pre class=&quot;xml hljs&quot;&gt; &lt;pre class=&quot;brush:php;toolbar:false&quot;&gt; &lt;code&gt; p { color: black; font-family: Helvetica, sans-serif; font-size: 1rem; } &lt;/code&gt; </pre><div class="contentsignin">Copy after login</div></div></pre><h2 id="item-6"><code><fig><figcaption>

这两个标签通常会一起出现。<figcaption> 用作 <fig> 的标题。

 <fig>
  <img  src="https://images.unsplash.com/photo-1600618538034-fc86e9a679aa?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="Useful HTML tags you might ignore (summary)" >
  <figcaption>basketball<figcaption/>
<fig>
Copy after login

这些标签也可以与代码块、视频和音频一起使用,如下所示。

代码块

 <figure>
  <pre class="brush:php;toolbar:false">
    <code>
      p {
          color: black;
          font-family: Helvetica, sans-serif;
          font-size: 1rem;
      }
    </code>
  
Copy after login
<figcaption>The code block

视频

 <figure>
 <video src="ex-b.mov"></video>
 <figcaption>Exhibit B. The <cite>Rough Copy</cite> trailer.</figcaption>
</figure>
Copy after login

音频

 <figure>
    <audio controls>
  <source src="audio.ogg" type="audio/ogg">
  <source src="audio.mp3" type="audio/mpeg">
</audio>
  <figcaption>An audio file</figcaption>
</figure>
Copy after login

<details><summary>

<details><summary> 用来创建一个可切换的部分。 <summary> 标签位于 <details> 标签内,单击后会自动显示和隐藏的内容。

最好用的地方是你可以用 CSS 去设置它们的样式,即使不依赖 JavaScript 也可以完美地工作。

 <details>
    <summary>
        <span>I am an introvert</span>
    </summary>

    <div>An introvert is a person with qualities of a personality type known as introversion, which means that they feel more comfortable focusing on their inner thoughts and ideas, rather than what&#39;s happening externally. They enjoy spending time with just one or two people, rather than large groups or crowds</div>
    <div>        
</details>
Copy after login

<cite><blockquote>

基本上 <blockquote> 是从另一个来源引用的部分。并添加了 <cite> 属性来指示源。

<blockquote cite="https://en.wikipedia.org/wiki/History_of_Nigeria">
The history of Nigeria can be traced to settlers trading across the middle East and Africa as early as 1100 BC. Numerous ancient African civilizations settled in the region that is known today as Nigeria, such as the Kingdom of Nri, the Benin Empire, and the Oyo Empire. Islam reached Nigeria through the Borno Empire between (1068 AD) and Hausa States around (1385 AD) during the 11th century,[1][2][3][4] while Christianity came to Nigeria in the 15th century through Augustinian and Capuchin monks from Portugal. The Songhai Empire also occupied part of the region.[5]
</blockquote>
Copy after login

如果使用 cite 属性,那么这个属性必须是指向源的有效 URL。要获得相应的引文链接,必须相对于元素的节点文档来解析属性的值。有时它们是私有的,例如调用服务器端脚本收集有关网站使用情况的统计信息。

<cite>

cite 元素表示作品或知识产权的标题,例如书籍、文章、论文、诗歌、歌曲等。

<p>The best movie ever made is <cite>The Godfather</cite> by
Francis Ford Coppola . My favorite song is <cite>Monsters You Made</cite> by the Burna boy.</p>
Copy after login

总结

我们应该更多地关注这些标记,并通过编写更多的语义代码来改善网站的功能。

更多编程相关知识,请访问:编程教学!!

The above is the detailed content of Useful HTML tags you might ignore (summary). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
The entire area