search
HomeWeb Front-endHTML TutorialDetailed description of HTML block-level elements

Detailed description of HTML block-level elements

Mar 15, 2017 pm 12:48 PM
html block level elements

Previous words

 Before HTML5 appeared, people generally divided elements into block-level, inline and inline block elements. This article will introduce the HTML block-level elements in detail

h

The title (Heading) element has six different levels,&lt ;h1> is the highest level, while <h6></h6> is the lowest. A title element that briefly describes the topic of the section

 From <h1></h1> to <h6></h6>, the importance gradually decreases and the font size decreases Small. When using title elements, pay attention to the following points

1. Do not use low-level titles in order to reduce the font of the title. Instead, use CSS font-sizestyle

  2. Avoid skipping certain levels of headings: always start with <h1></h1>, then use <h2></h2> etc.

  3 , when using the <section></section> element, for the sake of convenience, to avoid repeated use of <h1></h1> on one page, <h1></h1> should be used Indicates the title of the page. Other titles should start from <h2></h2>. When using <section></section>, each section should use a <h2></h2>

##[Default style]<p></p>
//从h1到h6
margin: 0.67em 0 -> 0.83em 0 -> 1em 0 -> 1.33em 0 -> 1.67em 0 -> 2.33em 0;
font-size: 2em -> 1.5em -> 1.17em -> 1em -> 0.83em -> 0.67em;
font-weight: bold;
  HTML5

New

tag, which represents the title group, is used to combine titles. It is only used when the block needs to have multiple levels of titles
<hgroup>
    <h1 id="水果">水果</h1>
    <h2 id="苹果">苹果</h2>
</hgroup>

# The element (paragraph) represents a paragraph of text. This element usually appears as a whole block of text separated from adjacent text, or as Vertical white space isolation or first line indentation<p></p>[Default style]

margin: 16px 0;

<p>段落1</p>
<p>段落2</p>
<p>段落3</p>

p

  <p></p> <p></p> The element (pide) (or

HTML document

partitioning element) is a general-purpose container for streaming content. It does not semantically represent any specific type of content. It can be used to

other

Elements are

grouped, generally used for styling-related needs (using class or id attributes) or to group a set of elements with the same characteristics (such as lang), which should be used only when no other semantic elements are available (such as

or

<hr>

to split between blocks

<p>段落1</p>
<hr>
<p>段落2</p>

[Default style]

margin: 8px 0;
border-style: inset;
border-width: 1px;

pre

  <pre class="brush:php;toolbar:false"></pre> element represents pre-formatted text. The text in this element is usually displayed in a fixed-width font according to the format in the original file. Whitespace characters (such as spaces and line breaks) in the text will be displayed, usually indicating typesetting content, such as code blocks and Character painting, etc.<pre class='brush:php;toolbar:false;'>&lt;pre class=&quot;brush:php;toolbar:false&quot;&gt; body { color:red; } </pre>[Default style]

margin: 1em 0;
white-space: pre;

blockquote

 

element (or HTML block level Quote element), which means that the text in it is the quoted content. Usually when rendering, the content of this part will be indented to a certain extent. If the citation comes from the Internet, you can set the source URL address of the original content to the cite attribute. If you want to inform readers of the source of the citation in the form of text, you can use the

element

 [Note] The signature of the citation must be defined outside the citation

<blockquote cite="http://baike.baidu.com/view/921793.htm">
  <p>横眉冷对千夫指,俯首甘为孺子牛</p>
</blockquote>    
<p>鲁迅</p>

[Default style]

margin: 1em  40px;

address    element allows the author to provide contact information for its nearest

or

ancestor element. In the latter case, it applies to the entire document

  当表示一个和联系信息无关的任意的地址时,使用<p></p>元素而不是<address></address>元素。这个元素不能包含除了联系信息之外的任何信息,比如出版日期(这应该包含在time>元素中)。通常,<address></address>元素可以放在当前section的<footer></footer>元素中,如果存在的话

【默认样式】

font-style: italic;

 

其他

  除了上面介绍的<p></p><h></h><p></p><hr><blockquote></blockquote><address></address>标签外,还有一些前面已经介绍过的标签属于块级标签

  包括骨架类标签(),列表类标签(<ul></ul><ol></ol>dl><dd></dd><dt></dt>),表单类标签(<a href="http://www.php.cn/wiki/125.html" target="_blank">for</a>m<fieldset></fieldset><output></output><legend></legend><optgroup></optgroup><option></option>),HTML5新增的结构标签(<article></article><aside></aside><header></header><footer></footer><nav></nav><section></section>),HTML5新增的多媒体标签(<figure></figure><figcaption></figcaption>),HTML5新增的功能性标签(<summary></summary><details></details>)

 

最后

  可能有人会觉得<br>标签应该是一个块级元素,因为它有换行,与块级元素的特征很相似。但它实际上是一个内联元素,它的用途是在文本中产生一个换行

The above is the detailed content of Detailed description of HTML block-level elements. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)