: The Content Division Element - HTML - MDN Web Docs
: The Content Division Element - HTML - MDN Web Docs
Có thể bạn quan tâm
- Skip to main content
- Skip to search
- Skip to select language
- References
- HTML
- Elements
- <div>
Article Actions- English (US)
- Remember language
- Deutsch
- Español
- Français
- 日本語
- Português (do Brasil)
- Русский
- 中文 (简体)
- 正體中文 (繁體)
- Try it
- Attributes
- Usage notes
- Accessibility
- Examples
- Technical summary
- Specifications
- Browser compatibility
- See also
- HTML
- Tutorials
- HTML basics
- Introduction to HTML
- Introduction to HTML overview
- Getting started with HTML
- What's in the head? Metadata in HTML
- HTML text fundamentals
- Creating hyperlinks
- Advanced text formatting
- Document and website structure
- Debugging HTML
- Assessment: Marking up a letter
- Assessment: Structuring a page of content
- Multimedia and embedding
- Multimedia and embedding overview
- Images in HTML
- Video and audio content
- From object to iframe — other embedding technologies
- Adding vector graphics to the web
- Responsive images
- Assessment: Mozilla splash page
- HTML tables
- HTML tables overview
- HTML table basics
- HTML table advanced features and accessibility
- Assessment: Structuring planet data
- References
- HTML elements
- <a>
- <abbr>
- <acronym> Deprecated
- <address>
- <area>
- <article>
- <aside>
- <audio>
- <b>
- <base>
- <bdi>
- <bdo>
- <big> Deprecated
- <blockquote>
- <body>
- <br>
- <button>
- <canvas>
- <caption>
- <center> Deprecated
- <cite>
- <code>
- <col>
- <colgroup>
- <data>
- <datalist>
- <dd>
- <del>
- <details>
- <dfn>
- <dialog>
- <dir> Deprecated
- <div>
- <dl>
- <dt>
- <em>
- <embed>
- <fencedframe> Experimental
- <fieldset>
- <figcaption>
- <figure>
- <font> Deprecated
- <footer>
- <form>
- <frame> Deprecated
- <frameset> Deprecated
- <h1>
- <head>
- <header>
- <hgroup>
- <hr>
- <html>
- <i>
- <iframe>
- <img>
- <input>
- <ins>
- <kbd>
- <label>
- <legend>
- <li>
- <link>
- <main>
- <map>
- <mark>
- <marquee> Deprecated
- <menu>
- <meta>
- <meter>
- <nav>
- <nobr> Deprecated
- <noembed> Deprecated
- <noframes> Deprecated
- <noscript>
- <object>
- <ol>
- <optgroup>
- <option>
- <output>
- <p>
- <param> Deprecated
- <picture>
- <plaintext> Deprecated
- <portal> Experimental
- <pre>
- <progress>
- <q>
- <rb> Deprecated
- <rp>
- <rt>
- <rtc> Deprecated
- <ruby>
- <s>
- <samp>
- <script>
- <search>
- <section>
- <select>
- <slot>
- <small>
- <source>
- <span>
- <strike> Deprecated
- <strong>
- <style>
- <sub>
- <summary>
- <sup>
- <table>
- <tbody>
- <td>
- <template>
- <textarea>
- <tfoot>
- <th>
- <thead>
- <time>
- <title>
- <tr>
- <track>
- <tt> Deprecated
- <u>
- <ul>
- <var>
- <video>
- <wbr>
- <xmp> Deprecated
- Global attributes
- accesskey
- anchor Experimental Non-standard
- autocapitalize
- autocorrect Experimental
- autofocus
- class
- contenteditable
- data-*
- dir
- draggable
- enterkeyhint
- exportparts
- hidden
- id
- inert
- inputmode
- is
- itemid
- itemprop
- itemref
- itemscope
- itemtype
- lang
- nonce
- part
- popover
- slot
- spellcheck
- style
- tabindex
- title
- translate
- virtualkeyboardpolicy Experimental
- writingsuggestions
- Attributes
- accept
- autocomplete
- capture
- crossorigin
- dirname
- disabled
- elementtiming
- for
- max
- maxlength
- min
- minlength
- multiple
- pattern
- placeholder
- readonly
- rel
- required
- size
- step
- <input> types
- <input type="button">
- <input type="checkbox">
- <input type="color">
- <input type="date">
- <input type="datetime-local">
- <input type="email">
- <input type="file">
- <input type="hidden">
- <input type="image">
- <input type="month">
- <input type="number">
- <input type="password">
- <input type="radio">
- <input type="range">
- <input type="reset">
- <input type="search">
- <input type="submit">
- <input type="tel">
- <input type="text">
- <input type="time">
- <input type="url">
- <input type="week">
- Guides
-
- Content categories
- Block-level elements
- Inline elements
- Quirks Mode and Standards Mode
- Date and time formats used in HTML
- Constraint validation
- Microdata
- Microformats
- Viewport meta tag
- Allowing cross-origin use of images and canvas
- Try it
- Attributes
- Usage notes
- Accessibility
- Examples
- Technical summary
- Specifications
- Browser compatibility
- See also
The <div> HTML element is the generic container for flow content. It has no effect on the content or layout until styled in some way using CSS (e.g. styling is directly applied to it, or some kind of layout model like Flexbox is applied to its parent element).
Try it
As a "pure" container, the <div> element does not inherently represent anything. Instead, it's used to group content so it can be easily styled using the class or id attributes, marking a section of a document as being written in a different language (using the lang attribute), and so on.
Attributes
This element includes the global attributes.
Note: The align attribute is obsolete; do not use it anymore. Instead, you should use CSS properties or techniques such as CSS Grid or CSS Flexbox to align and position <div> elements on the page.
Usage notes
- The <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate.
Accessibility
The <div> element has an implicit role of generic, and not none. This may affect certain ARIA combination declarations that expect a direct descendant element with a certain role to function properly.
Examples
A basic example
html<div> <p> Any kind of content here. Such as <p>, <table>. You name it! </p> </div> Result
A styled example
This example creates a shadowed box by applying a style to the <div> using CSS. Note the use of the class attribute on the <div> to apply the style named "shadowbox" to the element.
HTML
html<div class="shadowbox"> <p>Here's a very interesting note displayed in a lovely shadowed box.</p> </div> CSS
css.shadowbox { width: 15em; border: 1px solid #333; box-shadow: 8px 8px 5px #444; padding: 8px 12px; background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); } Result
Technical summary
Content categories Flow content, palpable content. Permitted content Flow content.Or (in WHATWG HTML): If the parent is a <dl> element: one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content.Or (in WHATWG HTML): <dl> element. Implicit ARIA role generic Permitted ARIA roles Any DOM interface HTMLDivElement
Specifications
Specification HTML Standard # the-div-element
Browser compatibility
BCD tables only load in the browser
See also
- Semantic sectioning elements: <section>, <article>, <nav>, <header>, <footer>
- <span> element for styling of phrasing content
Help improve MDN
Was this page helpful to you?YesNoLearn how to contribute.This page was last modified on Nov 21, 2024 by MDN contributors.
View this page on GitHub • Report a problem with this content
Từ khóa » Html5 Tag Div
-
HTML Div Tag - W3Schools
-
HTML 5 Tag
-
HTML Div – What Is A Div Tag And How To Style It With CSS
-
HTML | Div Tag - GeeksforGeeks
-
HTML Div Tag - Usage, Attributes, Examples - W3docs
-
How To Use The DIV Tag In HTML - Instructions - TeachUcomp, Inc.
-
HTML - Div Tag - Tutorialspoint
-
HTML Tag »
-
Role Of Div Tag In HTML5 - C# Corner
-
HTML Div Tag - Tutorial Republic
-
HTML Tutorial For Beginners 13 - The Div Tag - YouTube
-
7 Alternatives To The HTML Tag | By Zac Heisey - Medium
-
HTML Tag: Div | HTML Dog
-
HTML And CSS Tutorial - Nanyang Technological University
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu
Có thể bạn quan tâm
- Skip to main content
- Skip to search
- Skip to select language
- References
- HTML
- Elements
- <div>
- English (US)
- Remember language
- Deutsch
- Español
- Français
- 日本語
- Português (do Brasil)
- Русский
- 中文 (简体)
- 正體中文 (繁體)
- Try it
- Attributes
- Usage notes
- Accessibility
- Examples
- Technical summary
- Specifications
- Browser compatibility
- See also
- HTML
- Tutorials
- HTML basics
- Introduction to HTML
- Introduction to HTML overview
- Getting started with HTML
- What's in the head? Metadata in HTML
- HTML text fundamentals
- Creating hyperlinks
- Advanced text formatting
- Document and website structure
- Debugging HTML
- Assessment: Marking up a letter
- Assessment: Structuring a page of content
- Multimedia and embedding
- Multimedia and embedding overview
- Images in HTML
- Video and audio content
- From object to iframe — other embedding technologies
- Adding vector graphics to the web
- Responsive images
- Assessment: Mozilla splash page
- HTML tables
- HTML tables overview
- HTML table basics
- HTML table advanced features and accessibility
- Assessment: Structuring planet data
- References
- HTML elements
- <a>
- <abbr>
- <acronym> Deprecated
- <address>
- <area>
- <article>
- <aside>
- <audio>
- <b>
- <base>
- <bdi>
- <bdo>
- <big> Deprecated
- <blockquote>
- <body>
- <br>
- <button>
- <canvas>
- <caption>
- <center> Deprecated
- <cite>
- <code>
- <col>
- <colgroup>
- <data>
- <datalist>
- <dd>
- <del>
- <details>
- <dfn>
- <dialog>
- <dir> Deprecated
- <div>
- <dl>
- <dt>
- <em>
- <embed>
- <fencedframe> Experimental
- <fieldset>
- <figcaption>
- <figure>
- <font> Deprecated
- <footer>
- <form>
- <frame> Deprecated
- <frameset> Deprecated
- <h1>
- <head>
- <header>
- <hgroup>
- <hr>
- <html>
- <i>
- <iframe>
- <img>
- <input>
- <ins>
- <kbd>
- <label>
- <legend>
- <li>
- <link>
- <main>
- <map>
- <mark>
- <marquee> Deprecated
- <menu>
- <meta>
- <meter>
- <nav>
- <nobr> Deprecated
- <noembed> Deprecated
- <noframes> Deprecated
- <noscript>
- <object>
- <ol>
- <optgroup>
- <option>
- <output>
- <p>
- <param> Deprecated
- <picture>
- <plaintext> Deprecated
- <portal> Experimental
- <pre>
- <progress>
- <q>
- <rb> Deprecated
- <rp>
- <rt>
- <rtc> Deprecated
- <ruby>
- <s>
- <samp>
- <script>
- <search>
- <section>
- <select>
- <slot>
- <small>
- <source>
- <span>
- <strike> Deprecated
- <strong>
- <style>
- <sub>
- <summary>
- <sup>
- <table>
- <tbody>
- <td>
- <template>
- <textarea>
- <tfoot>
- <th>
- <thead>
- <time>
- <title>
- <tr>
- <track>
- <tt> Deprecated
- <u>
- <ul>
- <var>
- <video>
- <wbr>
- <xmp> Deprecated
- Global attributes
- accesskey
- anchor Experimental Non-standard
- autocapitalize
- autocorrect Experimental
- autofocus
- class
- contenteditable
- data-*
- dir
- draggable
- enterkeyhint
- exportparts
- hidden
- id
- inert
- inputmode
- is
- itemid
- itemprop
- itemref
- itemscope
- itemtype
- lang
- nonce
- part
- popover
- slot
- spellcheck
- style
- tabindex
- title
- translate
- virtualkeyboardpolicy Experimental
- writingsuggestions
- Attributes
- accept
- autocomplete
- capture
- crossorigin
- dirname
- disabled
- elementtiming
- for
- max
- maxlength
- min
- minlength
- multiple
- pattern
- placeholder
- readonly
- rel
- required
- size
- step
- <input> types
- <input type="button">
- <input type="checkbox">
- <input type="color">
- <input type="date">
- <input type="datetime-local">
- <input type="email">
- <input type="file">
- <input type="hidden">
- <input type="image">
- <input type="month">
- <input type="number">
- <input type="password">
- <input type="radio">
- <input type="range">
- <input type="reset">
- <input type="search">
- <input type="submit">
- <input type="tel">
- <input type="text">
- <input type="time">
- <input type="url">
- <input type="week">
- Guides
-
- Content categories
- Block-level elements
- Inline elements
- Quirks Mode and Standards Mode
- Date and time formats used in HTML
- Constraint validation
- Microdata
- Microformats
- Viewport meta tag
- Allowing cross-origin use of images and canvas
- Try it
- Attributes
- Usage notes
- Accessibility
- Examples
- Technical summary
- Specifications
- Browser compatibility
- See also
The <div> HTML element is the generic container for flow content. It has no effect on the content or layout until styled in some way using CSS (e.g. styling is directly applied to it, or some kind of layout model like Flexbox is applied to its parent element).
Try it
As a "pure" container, the <div> element does not inherently represent anything. Instead, it's used to group content so it can be easily styled using the class or id attributes, marking a section of a document as being written in a different language (using the lang attribute), and so on.
Attributes
This element includes the global attributes.
Note: The align attribute is obsolete; do not use it anymore. Instead, you should use CSS properties or techniques such as CSS Grid or CSS Flexbox to align and position <div> elements on the page.
Usage notes
- The <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate.
Accessibility
The <div> element has an implicit role of generic, and not none. This may affect certain ARIA combination declarations that expect a direct descendant element with a certain role to function properly.
Examples
A basic example
html<div> <p> Any kind of content here. Such as <p>, <table>. You name it! </p> </div>Result
A styled example
This example creates a shadowed box by applying a style to the <div> using CSS. Note the use of the class attribute on the <div> to apply the style named "shadowbox" to the element.
HTML
html<div class="shadowbox"> <p>Here's a very interesting note displayed in a lovely shadowed box.</p> </div>CSS
css.shadowbox { width: 15em; border: 1px solid #333; box-shadow: 8px 8px 5px #444; padding: 8px 12px; background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); }Result
Technical summary
Content categories | Flow content, palpable content. |
---|---|
Permitted content | Flow content.Or (in WHATWG HTML): If the parent is a <dl> element: one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts flow content.Or (in WHATWG HTML): <dl> element. |
Implicit ARIA role | generic |
Permitted ARIA roles | Any |
DOM interface | HTMLDivElement |
Specifications
Specification |
---|
HTML Standard # the-div-element |
Browser compatibility
BCD tables only load in the browser
See also
- Semantic sectioning elements: <section>, <article>, <nav>, <header>, <footer>
- <span> element for styling of phrasing content
Help improve MDN
Was this page helpful to you?YesNoLearn how to contribute.This page was last modified on Nov 21, 2024 by MDN contributors.
View this page on GitHub • Report a problem with this contentTừ khóa » Html5 Tag Div
-
HTML Div Tag - W3Schools
-
HTML 5
TagHTML Div – What Is A Div Tag And How To Style It With CSS
HTML | Div Tag - GeeksforGeeks
HTML Div Tag - Usage, Attributes, Examples - W3docs
How To Use The DIV Tag In HTML - Instructions - TeachUcomp, Inc.
HTML - Div Tag - Tutorialspoint
HTML Tag »Role Of Div Tag In HTML5 - C# Corner
HTML Div Tag - Tutorial Republic
HTML Tutorial For Beginners 13 - The Div Tag - YouTube
7 Alternatives To The
HTML Tag | By Zac Heisey - MediumHTML Tag: Div | HTML Dog
HTML And CSS Tutorial - Nanyang Technological University
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu