Tiết lộ. Hỗ trợ của bạn giúp giữ cho trang web hoạt động. Chúng tôi kiếm được phí giới thiệu cho một số dịch vụ chúng tôi đề xuất trên trang này. Tìm hiểu thêm
Element ofLearn How Fonts And Web Typography Work In HTML: A Beginner's GuideWhat does Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
3 do?The element is used to insert a line break or carriage-return within a parent element such as a paragraph without breaking out of the parent container.DisplayinlineUsagetextual
nội dung
- 1 Ví dụ về mã
- 2 Đừng lạm dụng ngắt dòng
- 3 Hỗ trợ trình duyệt cho br
- 4 Các thuộc tính của br
Mã ví dụ
This sentence and the next will be on different lines.
This sentence and the one before will be on different lines.
Câu này và câu tiếp theo sẽ khác dòng.
Câu này và câu trước sẽ khác dòng.
Đừng lạm dụng ngắt dòng
Phần tử
Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
4 tạo ngắt dòng. Có thể dễ dàng lạm dụng yếu tố này để tạo kiểu bắt chước tốt hơn, nhiều tùy chọn ngữ nghĩa hơn như đoạn văn [ Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
5 ] và danh sách. Nói chung, phần tử Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
4 chỉ nên được sử dụng nếu bản thân ngắt dòng là một phần nội tại của nội dung. Đây có thể là trường hợp, ví dụ, với- địa chỉ
- thơ
- mẫu mã
John Smith
c/o Jane Smythe
123 Main St.
Northeast Southwestershire, XY 12345
John Smith
c/o Jane Smythe
123 Main St.
Đông Bắc Southwestershire, XY 12345
Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
Từ màn đêm bao trùm lấy tôi,
Đen như hố từ cực này sang cực khác,
Tôi cảm ơn bất cứ vị thần nào
For my unconquerable soul. In the fell clutch of circumstance
Tôi không nhăn nhó cũng không khóc thành tiếng.
Dưới sự may rủi dùi cui
Đầu tôi đẫm máu, nhưng không cúi đầu. Bên ngoài nơi đầy phẫn nộ và nước mắt này
Lờ mờ nhưng Bóng tối kinh hoàng,
Và mối đe dọa của năm tháng
Tìm thấy . Điều quan trọng không phải là cổng hẹp như thế nào,
Cuộn giấy chứa đầy hình phạt như thế nào,
Tôi là người làm chủ số phận của mình.
Tôi là thuyền trưởng của tâm hồn tôi.- Invictus, bởi William Ernest Henley
Nếu bạn thấy mình đang sử dụng
Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
4 để phân tách các khối văn bản, bạn có thể cần nghĩ đến việc sử dụng thẻ đoạn văn hoặc yếu tố khác. Nếu bạn đang sử dụng chúng để tạo thêm khoảng cách giữa các mục, bạn nên sử dụng CSS Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
8 When writing a paragraph tag [
], especially in a WYSIWYG HTML editor, pressing the Enter key creates a new paragraph and not a new line. To create a new line in an HTML paragraph tag, follow the steps below depending on how you are writing the HTML.
Tạo một dòng mới trong mã HTML
If you are writing the HTML, you can create a new line using the
[break] tag, as shown in the example below.
mã ví dụ
Example of
text that is using
the <br> tag to break
a paragraph.
Đầu ra mã ví dụ
Example of text that is using the
tag to break a paragraph.
Tạo một dòng mới trong trình chỉnh sửa WYSIWYG
Có thể tạo một dòng mới trong trình soạn thảo WYSIWYG. Ví dụ bao gồm trình chỉnh sửa trực tuyến được sử dụng trong chương trình CMS, như WordPress hoặc trình chỉnh sửa HTML, như Dreamweaver, với phím tắt. Hầu hết các chương trình và biểu mẫu trực tuyến đều hỗ trợ phím tắt Shift+Enter. Để sử dụng phím tắt này, hãy di chuyển con trỏ văn bản đến nơi bạn muốn bắt đầu dòng mới. Sau đó, nhấn và giữ Shift, rồi nhấn Enter
Ghi chú
Nếu phím tắt này không hoạt động, bạn chỉ có thể nhập một dòng mới bằng cách chèn thủ công dấu ngắt dòng [thẻ "
"] trong mã HTML của tài liệu.
Ngắt dòng, đúng như tên gọi, là ngắt dòng 😅. Ngắt dòng trong HTML là điểm mà một dòng kết thúc theo chiều ngang và dòng tiếp theo bắt đầu trên một dòng mới
Trong HTML, khi bạn viết một chuỗi như thế này
Hello, I am
trying to create a
new line
Các khoảng trắng [không gian tab trước "Xin chào", khoảng trắng giữa "am" và "trying", "a" và "new"] sẽ bị bỏ qua. Kết quả trên màn hình sẽ hiện ra như thế này
Hello, I am trying to create a new line
Một cách để khắc phục điều này [dù không hiệu quả lắm] là tạo ba thẻ
Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find me, unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
— Invictus, by William Ernest Henley
5 như thế nàyHello, I am
trying to create a
new line
Điều này sẽ dẫn đến kết quả như sau
________số 8Bởi vì các thẻ
0 tạo ra các phần tửExample of
text that is using
the <br> tag to break
a paragraph.
Hello, I am trying to create a new line
0, chúng chiếm toàn bộ không gian theo chiều ngang và phần tử tiếp theo sẽ chuyển sang dòng tiếp theo – như bạn có thể thấy từ kết quả ở trênGiải pháp này không hiệu quả vì bạn đã tạo ba đoạn văn. Trong trường hợp trình đọc màn hình diễn giải điều này, nó sẽ đọc thành ba đoạn văn thay vì một câu. Điều này có thể ảnh hưởng đến khả năng truy cập web
Vậy làm cách nào để bạn thêm ngắt dòng cho phần tử nội tuyến?
Cách thêm ngắt dòng trong HTML
HTML có các thẻ cho nhiều mục đích, kể cả để tạo ngắt dòng. Bạn có thể sử dụng thẻ
Hello, I am trying to create a new line
1 trong HTML để thêm ngắt dòng. Nó có thể đi giữa các phần tử nội tuyến để chia các phần tử thành nhiều phầnĐây là một ví dụ về đoạn văn có thẻ
Hello, I am trying to create a new line
1John Smith
c/o Jane Smythe
123 Main St.
Northeast Southwestershire, XY 12345
2Thẻ
Hello, I am trying to create a new line
1 là phần tử void không có thẻ đóng. Thay vào đó, nó là một thẻ tự đóngĐoạn mã trên dẫn đến điều này
________số 8Bạn có thể sử dụng thẻ này cho các dạng phần tử nội tuyến khác như liên kết. Ví dụ, nhìn vào mã này
John Smith
c/o Jane Smythe
123 Main St.
Northeast Southwestershire, XY 12345
5Các thẻ neo,
Hello, I am trying to create a new line
4, là các phần tử nội tuyến, vì vậy thay vì liên kết thứ hai hiển thị trên dòng tiếp theo, nó sẽ hiển thị trong cùng một dòng như thế nàyBạn có thể sử dụng thẻ
Hello, I am trying to create a new line
1 giữa các liên kết để ngắt dòng liên kết đầu tiênJohn Smith
c/o Jane Smythe
123 Main St.
Northeast Southwestershire, XY 12345
8Kết luận
Thẻ
Hello, I am trying to create a new line
1 trong HTML bắt đầu phần tử tiếp theo trên một dòng mới, tương tự như dấu xuống dòng Hello, I am trying to create a new line
7 trong chuỗiThay vì sử dụng các phần tử khối để đặt các phần tử vào dòng mới, bạn có thể sử dụng thẻ ngắt dòng.
Hello, I am trying to create a new line
1Trong các trường hợp như câu, việc sử dụng thẻ
Hello, I am trying to create a new line
1 đóng vai trò ngắt dòng trực quan và không ảnh hưởng đến khả năng truy cập. Trình đọc màn hình sẽ đọc câu đó mà không tạm dừngQUẢNG CÁO
QUẢNG CÁO
QUẢNG CÁO
Người ủng hộ nhà phát triển và Người sáng tạo nội dung đam mê chia sẻ kiến thức của tôi về Công nghệ. Tôi dạy JavaScript / ReactJS / NodeJS / React Frameworks / TypeScript / et al
Nếu bạn đọc đến đây, hãy tweet cho tác giả để cho họ thấy bạn quan tâm. Tweet một lời cảm ơn
Học cách viết mã miễn phí. Chương trình giảng dạy mã nguồn mở của freeCodeCamp đã giúp hơn 40.000 người có được việc làm với tư cách là nhà phát triển. Bắt đầu