📜  物理标签和逻辑标签之间的区别

📅  最后修改于: 2022-05-13 01:56:32.909000             🧑  作者: Mango

物理标签和逻辑标签之间的区别

在本文中,我们将了解 HTML 中的物理标签和逻辑标签及其实现。我们还将探讨它们之间的区别。让我们从物理标签开始讨论。

物理标记:物理标记用于指示如何使用 HTML 标记格式化或指示特定字符。任何物理样式标签都可以包含文本中允许的任何项目,包括常规文本、图像、换行符等。物理标签只能用于特定元素的样式。尽管每个物理标签都有定义的样式,但您可以通过为每个标签定义自己的外观来覆盖该样式。所有物理标签都需要结束标签。请参阅 HTML 中的物理标签是什么?文章了解更多详情。

句法 :

Content

特征:

  • 它们非常简单。
  • 它们用于突出显示重要的句子。
  • 物理文本样式指示部分的特定外观类型,例如粗体、斜体等。
  • 所有浏览器都以相同的方式呈现物理样式。

以下是一些有用的物理标签列表:

  • 上标通常用于显示基线以上的元素
  • 下标用于替代基线。
  • 斜体标签用于定义具有特殊含义的文本。
  • 大标签将字体大小加一(注意:在 HTML 5 中不能使用大标签)
  • 小标签定义小文本,在写版权时使用。
  • 粗体增加了文本的重要性,因为粗体标签将文本转换为粗体。
  • 用于给文本加下划线。
  • Teletype 文本给出了默认的等宽字体系列。
  • 这是一个编辑标记,告诉读者忽略文本段落。

例子:

HTML


  

    Physical Tags
    

  

    
        

GeeksforGeeks

        Welcome to the official channel of GeeksforGeeks!                      Learn Data Structures Online At Your              Own Pace With The Best Of Faculty             In The Industry.                                  A Computer Science portal for geeks.              It contains well written, well thought              and well explained computer science              and programming articles.                                  The Best Data Structures Course              Available Online From Skilled And             Experienced Faculty.                                  Python is a widely used, high-level              programming language.                     52 SO2                         We provide a variety of services for              you to learn, thrive and also have             fun!                                  Free Tutorials, Millions of Articles,              Live, Online and Classroom Courses,              Frequent Coding Competitions, Webinars             by Industry Experts, Internship              opportunities and Job Opportunities.              Knowledge is power!              
  


HTML


  

    Logical Tag
  
    

  

    
        

GeeksForGeeks

           Welcome to Logical tags            This is GFG            
            5th Floor, A-118, Sector-136, Noida,              Uttar Pradesh - 201305         
            C++ is my favourite Language.             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.         

           This is a Keyboard input            
            Hello GFG,
            Greetings to all Community members !!
            Here I'm presenting my first blog of GFG Blogathon-2021.
            This is a predefine formatted text 
        
    
  


输出:

逻辑标签:逻辑标签用于告诉浏览器在标签内写入什么样的文本。逻辑标签也称为结构标签,因为它们指定了文档的结构。逻辑标签用于向视障人士表明文本中有更重要的内容或强调文本,即逻辑标签可用于样式目的以及对文本内容给予特殊重视。请参阅 HTML 中的逻辑标签是什么?文章了解更多详情。

句法 :

Content        

逻辑标签有用的一些情况:

  • 在我们的网站上编写代码。
  • 强调一些文字。
  • 在网页上显示缩写。
  • 在我们的网页上显示一些著名的报价。
  • 写一些关于变量的数学公式。

以下是一些有用的逻辑标签列表:

  • 定义文本的缩写。
  • 定义首字母缩写词。
  • 个人或组织的联系信息。
  • 定义引用。它以斜体格式显示文本。
  • 定义一段计算机代码。
  • 定义一个长引用。
  • 定义已删除的文本,用于标记已从文档中删除的部分文本。
  • 定义定义元素,用于在 HTML 中表示定义实例。
  • 定义插入的文本。
  • 定义键盘输入文本。
  • 定义预格式化文本块,保留文本空格、换行符、制表符和其他被 Web 浏览器忽略的格式化字符。
  • 定义短引号。
  • 定义来自计算机程序的示例输出文本。
  • 定义强文本,即显示文本的重要性。
  • 在数学方程式或计算机程序中定义变量。

    例子:

    HTML

    
    
      
    
        Logical Tag
      
        
    
      
    
        
            

    GeeksForGeeks

               Welcome to Logical tags            This is GFG            
                5th Floor, A-118, Sector-136, Noida,              Uttar Pradesh - 201305         
                C++ is my favourite Language.             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.         

               This is a Keyboard input            
                Hello GFG,
                Greetings to all Community members !!
                Here I'm presenting my first blog of GFG Blogathon-2021.
                This is a predefine formatted text 
            
        
      

    输出:

    逻辑标签和物理标签的区别:

    S.No.

    Logical tags                       

    Physical tags      

    1.

    Logical tags describe the behaviour, nature of content for the text enclosed inside the tag. They represent the function of text on the page.

    Physical tags are used to decide the appearance of the text and do not provide any information about the text.

    2.

    It carries certain obligations.

    It is extremely straightforward.

    3.

    It is used to mention visually impaired texts.

    It is used to indicate the specific characters which need formation.

    4.

    Here, the pages are more accessible.

    Page accessibility is comparatively low.

    5.

    It supports the latest technology.

    This concept is dependent upon weak tools.

    6.

    Logical tags are used to provide information by giving the special importance to the text. For instance, tag is used to emphasize the text by representing it in italic format.

    Physical tags are used to style the content only. For instance, is used to display the text in italic format.