Common text labels

Posted by tpearce2 on Sun, 13 Feb 2022 17:34:51 +0100

1, Comments in html

1.1 annotation label

Shortcut keys for adding comments in the development environment:

  • windows system: ctrl +/
  • Apple system: cmd +/

1.2 general format of notes

<!--This is a comment. Comments are not displayed in the browser.-->

1.3 condition notes

<!--[if IE 8]>
.... some HTML here ....

2, Common tags in head

2.1 meta label

2.1.1 function of meta label

  • The < meta > element can provide meta information about the page, description and keywords for search engine and update frequency.
  • The < meta > tag is at the head of the document and contains nothing.
  • The information provided by < meta > is invisible to the user

2.1.2 two attributes of meta tag

  • name attribute: mainly used to describe Web pages. The attribute value content is mainly used by search engines to find and classify information.
<meta name="keywords" content="Pets, pet,Pet cat, pet dog"> <!-- Specifies the keyword of the web page, which is used by the search engine -->
<meta name="description" content="This is a pet website">	<!-- Specifies the description of the web page used by search engines -->
  • HTTP equiv attribute: the information provided to the browser in order to correctly display the web page content. The attribute value content contains the variable value of each parameter.
<meta http-equiv = "Refresh" content="2;URL=">
<!--(Note the quotation marks after 2: refresh after 2 seconds and jump to the specified page)-->
<meta http-equiv = "content-Type" charset=UTF8">
<!--Set page resolution character set -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- When browsing a web page on a mobile device, the web page does not zoom -->
<meta http-equiv = "X-UA-Compatible" content = "IE=EmulateIE8" >
<!-- stay ie When browsing a web page, use ie of IE8 edition -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	<!--Set browser rendering mode-->

Icon download website:
Document production website:

2.2 non meta tags

<title>Page title</title>
<link rel="shortcut icon" href="">
<!--Set website icon, favorite Icon-->
<link rel="stylesheet" href="base.css">	<!--Import style file-->
<script src="login.js"></script>	<!--Import script file-->

3, Common labels in body

3.1 title label

<!DOCTYPE html>
		<meta charset="utf-8">
		<h1>Title 1</h1>
		<h2>Title 2</h2>
		<h3>Title 3</h3>
		<h4>Title 4</h4>
		<h5>Title 5</h5>
		<h6>Title 6</h6>

Line breaks and paragraph labels

<!DOCTYPE html>
		<meta charset="utf-8">
		<!--Exclusive paragraph, there will be some space before and after the paragraph-->
		<p>Paragraph label</p>
		<!--Line feed-->
		<!--level\Split line-->
		<!-- pre The label is output in the original format of the text-->
		Work overtime, party, business trip and travel. When there is no one to take care of the pet at home, place an order with one button and walk the dog on the door/Cat watching, door-to-door foster care,
		Help you take care of your pet who has been waiting at home for a long time, including going out for a walk, eating, shoveling excrement and other services.

3.3 text formatting labels

<!DOCTYPE html>
		<meta charset="utf-8">

3.4 image labels

<img src="dog.jpg" alt="Pictures of dogs" title="pet dog" width="500px" height="500px">

Attribute adopts key value pair format: key = "value"

3.4.1 image label attributes

src: the path to display the picture
alt: prompt when the picture is not loaded successfully
title: prompt information when the mouse hovers
Width: the width of the picture, which can also be set as a percentage of the browser width
Height: the height of the picture (only one of the two attributes of width and height will be automatically scaled proportionally.)

3.4.2 path of image label

Relative path

  • The directory path is established based on the location of the reference file
  • Same level path: located at the same level of HTML file
  • Next level path:/
  • Upper level path:/
<!-- Relative path mode 1 --> 
<img src="./images/logo.png"> 
<!-- Relative path mode 2 --> 
<img src="images/logo.png"> absolute path

  • It refers to the absolute position in the directory and directly reaches the target position, usually starting from the drive letter
  • Or the absolute path address on the network
<!-- Absolute path mode 1 --> 
<img src="D:/itsishu/images/logo.png"> 
<!-- Absolute path mode 2 --> 
<img src="">

For non copyrighted pictures, you can search keywords such as "non copyrighted pictures" and "CC0" materials
Reference: 15 non copyright material websites
15 high quality copyright free image websites

4, Common special characters

5, Comprehensive application

<!DOCTYPE html>
		<meta charset="utf-8">
		<title>Two Acacia</title>
		<!-- Generate favorites Mini Icon -->
		<link rel="icon" href="favicon.ico"/>
		<!-- First level Title centered -->
		<h1 align="center">
			<img src="images/love.png">Two Acacia</h1>
		<p align="center">[Song] Li&nbsp;Yu <br/></p>
		<!-- Center paragraph -->
		<p align="center">
			Poetry of missing wife<b>[[read in sequence]</b><!-- Bold --><br/>
		Dry eyes look at the remote mountain across the water. How many hearts have you seen?<br/><!-- Line feed -->
		An empty pot is afraid of drinking a glass of wine, and it is difficult to write rhymes.<br/>
		The way is blocked, and the departure is long, and the message is sent back late without wild geese.<br/>
		The night watchman is lonely, and the husband remembers his wife and the father remembers his son.
		<pre align="center">
Si Fu Poetry<u><i>[Read backwards]</i></u><!-- Italic underline -->
The son remembers his father, the wife remembers her husband, and the night light is lonely.
There is no news from the late returning geese. They leave people for a long time and block the way.
Poetry and harmony are difficult to write, and a glass of wine is afraid of an empty pot.
A bosom friend sees that he has been in and out, and his eyes are dry across the mountain.
		<p align="center">
			<!-- Insert picture -->
		<img src="images/1.jfif" width="500px" title="Two Acacia" alt="Mountain and sea">
		<p align="center">
		&copy;Liu Xu&amp;Xu Liu<br>
		&lt;China &#8226; Haikou & gt; <-- Use of special characters -- >

6, Summary

This article describes some common text labels and use cases.

Topics: Front-end html css