<br>: The Line Break element - HTML | MDN

<br>: The Line Break element - HTML | MDN

In Stock



Total: $24.99 $29.99

Add to Cart

Chính Sách Vận Chuyển Và Đổi Trả Hàng

Miễn phí vận chuyển mọi đơn hàng từ 500K

- Phí ship mặc trong nước 50K

- Thời gian nhận hàng 2-3 ngày trong tuần

- Giao hàng hỏa tốc trong 24h

- Hoàn trả hàng trong 30 ngày nếu không hài lòng

Mô tả sản phẩm

Try it

O’er all the hilltops
Is quiet now,
In all the treetops
Hearest thou
Hardly a breath;
The birds are asleep in the trees:
Wait, soon like these
Thou too shalt rest.

p {
  font-size: 1rem;
  font-family: sans-serif;
  margin: 20px;
}

As you can see from the above example, a
element is included at each point where we want the text to break. The text after the
begins again at the start of the next line of the text block.

Note: Do not use
to create margins between paragraphs; wrap them in

elements and use the CSS margin property to control their size.

Attributes

This element's attributes include the global attributes.

Deprecated attributes

clear Deprecated

Indicates where to begin the next line after the break.

Styling with CSS

The
element has a single, well-defined purpose — to create a line break in a block of text. As such, it has no dimensions or visual output of its own, and there is very little you can do to style it.

You can set a margin on
elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice — you should use the line-height property that was designed for that purpose.

Accessibility

Creating separate paragraphs of text using
is not only bad practice, it is problematic for people who navigate with the aid of screen reading technology. Screen readers may announce the presence of the element, but not any content contained within
s. This can be a confusing and frustrating experience for the person using the screen reader.

Use

elements, and use CSS properties like margin to control their spacing.

Examples

Basic br

In the following example we use
elements to create line breaks between the different lines of a postal address:

Mozilla
331 E. Evelyn Avenue
Mountain View, CA
94041
USA

Result

Technical summary

Content categories Flow content, phrasing content.
Permitted content None; it is a void element.
Tag omission Must have a start tag and must not have an end tag. In XHTML documents, write this element as
.
Permitted parents Any element that accepts phrasing content.
Implicit ARIA role No corresponding role
Permitted ARIA roles none, presentation
DOM interface HTMLBRElement

Specifications

Specification
HTML# the-br-element

Browser compatibility

See also

  • element
  • element

  • element