HTML
Tag
Có thể bạn quan tâm
The HTML <br> tag is used for creating the 'br' element, which represents a line break in an HTML document.
The <br> element is classified as a "void element" as it has no content. This also means that no end tag is required (or allowed for that matter).
The <br> tag must be used only for line breaks that are actually part of the content, as in poems or addresses. It should not be used for separating thematic groups in a paragraph. To separate thematic groups, use multiple <p> tags instead.
Also see the <wbr> tag for specifying a line break opportunity.
Syntax
The <br> tag is written as <br> at the point where the line break should occur.
Like this:
Line 1<br> Line 2Examples
Addresses
One good example where the <br> tag can be used is for presenting addresses (such as street addresses). This is because addresses usually have one or more line breaks as part of the content.
<address> African Wildlife Foundation<br> Ngong Road, Karen<br> P.O. Box 310, 00502<br> NAIROBI, KENYA </address>Poetry/Lyrics
Another example of <br> usage is with poetry or song lyrics.
<blockquote> Love is not a thing to understand.<br> Love is not a thing to feel.<br> Love is not a thing to give and receive.<br> Love is a thing only to become<br> And eternally be. </blockquote> <cite>Sri Chinmoy</cite>Line Breaks and CSS
Although it is used for creating a line break, the HTML5 specification allows for the <br> element to be styled in such a way that the browser does not render line breaks. In particular, it reads:
While line breaks are usually represented in visual media by physically moving subsequent text to a new line, a style sheet or user agent would be equally justified in causing line breaks to be rendered in a different manner, for instance as green dots, or as extra spacing. - HTML5 Specification
The <wbr> Tag
Also see the <wbr> tag for specifying a line break opportunity.
Attributes
Attributes can be added to an HTML element to provide more information about how the element should appear or behave.
The <br> element accepts the following attributes.
Attribute | Description |
---|---|
None |
Global Attributes
The following attributes are standard across all HTML elements. Therefore, you can use these attributes with the <br> tag , as well as with all other HTML tags.
- accesskey
- autocapitalize
- class
- contenteditable
- data-*
- dir
- draggable
- hidden
- id
- inputmode
- is
- itemid
- itemprop
- itemref
- itemscope
- itemtype
- lang
- part
- slot
- spellcheck
- style
- tabindex
- title
- translate
For a full explanation of these attributes, see HTML 5 global attributes.
Event Handlers
Event handler content attributes enable you to invoke a script from within your HTML. The script is invoked when a certain "event" occurs. Each event handler content attribute deals with a different event.
- onabort
- onauxclick
- onblur
- oncancel
- oncanplay
- oncanplaythrough
- onchange
- onclick
- onclose
- oncontextmenu
- oncopy
- oncuechange
- oncut
- ondblclick
- ondrag
- ondragend
- ondragenter
- ondragexit
- ondragleave
- ondragover
- ondragstart
- ondrop
- ondurationchange
- onemptied
- onended
- onerror
- onfocus
- onformdata
- oninput
- oninvalid
- onkeydown
- onkeypress
- onkeyup
- onlanguagechange
- onload
- onloadeddata
- onloadedmetadata
- onloadstart
- onmousedown
- onmouseenter
- onmouseleave
- onmousemove
- onmouseout
- onmouseover
- onmouseup
- onpaste
- onpause
- onplay
- onplaying
- onprogress
- onratechange
- onreset
- onresize
- onscroll
- onsecuritypolicyviolation
- onseeked
- onseeking
- onselect
- onslotchange
- onstalled
- onsubmit
- onsuspend
- ontimeupdate
- ontoggle
- onvolumechange
- onwaiting
- onwheel
Most event handler content attributes can be used on all HTML elements, but some event handlers have specific rules around when they can be used and which elements they are applicable to.
For more detail, see HTML event handler content attributes.
Từ khóa » Html Br Options
-
The
HTML Element Produces A Line Break In Text (carriage-return). It Is Useful For Writing A Poem Or An Address, Where The Division Of Lines Is Significant. ... Technical Summary. -
HTML Br Tag - W3Schools
-
Add A Line Break In HTML - Tutorial - TeachUcomp, Inc.
-
Using Br To Insert Line Breaks In HTML: Here's How »
-
Line Break In HTML Select Option? - Stack Overflow
-
HTML
Tag - W3docs -
Br | Dash For Python Documentation | Plotly
-
HTML
Tag - GeeksforGeeks -
Main Tips On HTML Line Break - BitDegree
-
HTML Line Break – How To Break A Line With The HTML
Tag -
What Is The Best Alternative To Repetitive Typing Of
Tags In HTML ... -
Alignment, Font Styles, And Horizontal Rules In HTML Documents
-
HTML Standard
-
Br Tag In HTML - Scaler Topics