The Centered Text Element - HTML: HyperText Markup Language
Có thể bạn quan tâm
- References
- HTML
- Elements
- <center>
- English (US)
- Remember language
- Deutsch
- Español
- Français
- 日本語
- 한국어
- Português (do Brasil)
- 中文 (简体)
- 正體中文 (繁體)
- DOM interface
- Example 1
- Example 2 (CSS alternative)
- Example 3 (CSS alternative)
- Specifications
- Browser compatibility
- See also
- HTML
- Beginner's tutorials
- Your first website: Creating the content
- Structuring content with HTML
- Basic HTML syntax
- What's in the head? Webpage metadata
- Headings and paragraphs in HTML
- Emphasis and importance
- Lists
- Structuring documents
- Advanced text features
- Creating links
- Challenge: Marking up a letter
- Challenge: Structuring a page of content
- HTML images
- HTML video and audio
- Challenge: Mozilla splash page
- HTML table basics
- HTML table accessibility
- Challenge: Structuring a planet data table
- Forms and buttons in HTML
- Debugging HTML
- 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
- 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">
- DOM interface
- Example 1
- Example 2 (CSS alternative)
- Example 3 (CSS alternative)
- Specifications
- Browser compatibility
- See also
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The <center> HTML element is a block-level element that displays its block-level or inline contents centered horizontally within its containing element. The container is usually, but isn't required to be, <body>.
This tag has been deprecated in HTML 4 (and XHTML 1) in favor of the CSS text-align property, which can be applied to the <div> element or to an individual <p>. For centering blocks, use other CSS properties like margin-left and margin-right and set them to auto (or set margin to 0 auto).
DOM interface
This element implements the HTMLElement interface.
Example 1
html<center> This text will be centered. <p>So will this paragraph.</p> </center>Result
Example 2 (CSS alternative)
html<div style="text-align:center"> This text will be centered. <p>So will this paragraph.</p> </div>Result
Example 3 (CSS alternative)
html<p style="text-align:center"> This line will be centered.<br /> And so will this line. </p>Result
Note: Applying text-align: center to a <div> or <p> element centers the contents of those elements while leaving their overall dimensions unchanged.
Specifications
Specification |
---|
HTML Standard # center |
Browser compatibility
BCD tables only load in the browser
See also
- text-align
- display
Help improve MDN
Was this page helpful to you?YesNoLearn how to contribute.This page was last modified on Aug 12, 2024 by MDN contributors.
View this page on GitHub • Report a problem with this contentTừ khóa » Html Br Alternatives
-
What Is The Alternative To
If I Want To Control The Height Between ... -
What Is The Best Alternative To Repetitive Typing Of
Tags In HTML ... -
How To Break Line Without Using
Tag In HTML / CSS -
Alternative To BR TAG | Learn HTML CSS - YouTube
-
How To Break Line Without Using
Tag In CSS - W3docs -
What To Use Instead Of
- HTML Forum At WebmasterWorld -
Tag Alternatives? - Web Hosting Talk -
Alternative To
Inside- - HTML & CSS - SitePoint Forums
-
[Solved] Spacing Text In CSS, Alternatives To The BR Tag
-
Search Code Snippets | Alternative Br Tag Css
-
: The Line Break Opportunity Element - HTML - MDN Web Docs -
Br Alternative Tag In Html Code Example - Newbedev
-
HTML Pre Tag - W3Schools
-
4.6. Precise Spacing And Layout - HTML & XHTML - O'Reilly