📜  什么是 HTML 中的逻辑标签?

📅  最后修改于: 2021-11-10 04:02:42             🧑  作者: Mango

逻辑标签用于告诉浏览器标签内写入的文本类型。它们与物理标签不同,因为物理标签用于决定文本的外观,不提供有关文本的任何信息。

逻辑标签用于向视障人士表明文本中有更重要的内容或强调文本。

我们可以使用逻辑标签的一些情况是:

  • 当我们想在我们的网站上编写代码时。
  • 当我们想强调一些文字时。
  • 当我们想在网页上显示缩写时。
  • 当我们想在我们的网页上显示一些著名的语录时。
  • 当我们想根据变量编写一些数学公式时。

这里有很多种逻辑文本是其中一些的列表:

Tag Description
Defines the abbreviation of text.
Defines the acronym.
contact information of a person or an organization.
Defines citation. It displays the text in italic format.
Defines the piece of computer code.
Defines a long quotation.
Defines the deleted text and is used to mark a portion of text which has been deleted from the document.
Defines the definition element and is used to representing a defining instance in HTML.
Defines inserted text.
Defines keyboard input text.
Defines the block of preformatted text which preserves the text spaces, line breaks, tabs, and other formatting characters which are ignored by web browsers.
Defines the short quotation.
Defines the sample output text from a computer program.
Defines strong text i.e. show the importance of the text.
Defines the variable in a mathematical equation or in the computer program.

现在让我们通过例子来实现上面列出的一些标签

1. 标签: 标签代表双向覆盖。此标签用于更改文本的方向。它需要一个“dir”属性来决定文本的方向。

句法:

 Statements... 
HTML


  

    

This text will go right-to-left

       GeeksforGeeks        

This text will go left-to-right

       GeeksforGeeks   


HTML


  

    

Welcome to year 2020 2021

  


HTML


  

    

price of this shoe is          1000850     

  


HTML


  

    

This is         bolded (important) text.     

  


HTML


  

    

This is your code

  


HTML


  

    

        Press Ctrl +          C To copy text     

  


HTML


  

    
 Welcome     to geeks   for
          geeks
       this   is
       pre     tag
  
  


HTML


  

    

Logical Tags

            Welcome to         GFG          
            This is         GFG          
            
        GeeksforGeeks, 5th & 6th Floor,         Royal Kapsons, A- 118, Sector- 136,          Noida, Uttar Pradesh (201305)     
    
             GeeksforGeeks is          my favourite website.     
                      Sample code: system.out.println();                  
        A Computer Science portal for geeks.          It contains well written, well          thought and well explained computer          science and programming articles,          and quizzes.     
             This contains deleted content.              Newly inserted content.             

         GeeksforGeeks is a          Computer Science portal for geeks.          It contains well written, well          thought and well explained computer          science and programming articles,          and quizzes.     

                      GeeksforGeeks - This is          a Keyboard input                   
    Dear User,
   
    Congratulations !!
   
    We are delighted to inform you that 
    you are going to be part of GfG journey.
   
    Thanks,
    GfG Team
   
This is a predefine formatted text
    
  


输出:

This text will go right-to-left
skeeGfofskeeG
This text will go left-to-right
GeeksforGeeks

2. 标签: 标签画一条线切割文本,显示文本错误或已删除。

句法:

Statements... 

HTML



  

    

Welcome to year 2020 2021

  

输出:

3. 标签: 标签用于显示某些文本被插入到文档中。浏览器通常会显示带下划线的插入标签。

句法:

Statements... 

HTML



  

    

price of this shoe is          1000850     

  

输出:

4. 标签 标签用来告诉浏览器这个标签里面的文字是非常重要和有意义的。浏览器以粗体显示此文本。

句法:

Statements...  

HTML



  

    

This is         bolded (important) text.     

  

输出:

5、标签: code标签用来告诉用户这个标签里面写的文字是某种编程语言的代码。此标签内的内容以等宽字体显示。

句法:

Statements... 

HTML



  

    

This is your code

  

输出:

6. 标签: 标签用于表示显示的文本是从键盘输入的。里面的内容以等宽字体显示。

句法:

Statements... 

HTML



  

    

        Press Ctrl +          C To copy text     

  

输出:

  • 7.
     标签 pre 标签中的文本以固定宽度字体显示,并保留所有空格和换行符,即文本显示与 HTML 源代码中编写的完全相同。
    

    句法:

    Statements...  

    HTML

    
    
      
    
        
     Welcome     to geeks   for
              geeks
           this   is
           pre     tag
      
      

    输出:

    使用逻辑标签的示例代码:此示例包含所有逻辑标签。

    HTML

    
    
      
    
        

    Logical Tags

                Welcome to         GFG          
                This is         GFG          
                
            GeeksforGeeks, 5th & 6th Floor,         Royal Kapsons, A- 118, Sector- 136,          Noida, Uttar Pradesh (201305)     
        
                 GeeksforGeeks is          my favourite website.     
                          Sample code: system.out.println();                  
            A Computer Science portal for geeks.          It contains well written, well          thought and well explained computer          science and programming articles,          and quizzes.     
                 This contains deleted content.              Newly inserted content.             

             GeeksforGeeks is a          Computer Science portal for geeks.          It contains well written, well          thought and well explained computer          science and programming articles,          and quizzes.     

                          GeeksforGeeks - This is          a Keyboard input                   
        Dear User,
       
        Congratulations !!
       
        We are delighted to inform you that 
        you are going to be part of GfG journey.
       
        Thanks,
        GfG Team
       
    This is a predefine formatted text
        
      

    输出: