HTMLs Tutorial

HTML Tutorial HTML Tags HTML Basic Tags HTML Attributes HTML Elements HTML Formatting HTML Text Format HTML body tag HTML samp tag HTML script Tag HTML section tag HTML select tag HTML source tag HTML span tag HTML strike tag HTML strong tag HTML style tag HTML sub tag HTML summary tag HTML sup Tag HTML svg tag HTML table tag HTML u tag HTML Headings HTML Paragraphs HTML wbr tag HTML Anchor HTML Image HTML Lists HTML Ordered List HTML Unordered List HTML Form HTML Form input HTML with CSS HTML Layouts HTML References HTML Frames HTML Links Fieldset Tag in HTML Basic HTML Tags Br Tag in HTML Free HTML Templates How to Create a Table in HTML HTML Calendar HTML Card HTML Cellspacing HTML Center Image HTML Checkbox Read-only HTML Cleaner HTML Code for a Tab HTML Comment HTML Compiler HTML Nested Forms HTML Overlay Text on the Image HTML Select Option Default HTML Snake Game HTML Subheader HTML Tab Character dd Tag in HTML How Many HTML Tags are There HTML Align Tag HTML Responsive HTML Tab Code HTML Table Alternate Row Color HTML Table Fix Column Width Contact HTML DL Tag in HTML How to Insert Image in HTML HTML Background Color HTML Dark Mode How to Convert HTML to PNG HTML Data Toggle HTML Email Template HTML Font Color HTML Font Family ID and Class in HTML HTML Tab Space HTML Tab Tag HTML Itemprop HTML Itemscope HTML Form Design HTML Input Only Numbers HTML Textarea HTML to JPG HTML to Markdown Python li Tag in HTML MDN HTML What is the Correct HTML for Making a Hyperlink? What is the Root Element of an HTML Document How to Make a Box in HTML How to Save HTML Files in Notepad How to Align Text in HTML How to Change Font Color in HTML? How to Change Font Size in HTML How to Change Image Size in HTML How to Create a HTML Page How to Create a Link in HTML File? How to Create an HTML File? HR Tag in HTML HTML Base Tag HTML Default Attribute HTML Hyperlink HTML Indent HTML Injection Payloads HTML Input Numbers Only HTML Roadmap HTML Row Height HTML Schedule HTML Space HTML Tab HTML vs HTTP HTML5 API HTML5 Video HTML Collection to Array Text Area in HTML

HTML5 Advance

HTML5 Tutorial HTML5 Tags HTML Button Tag HTML canvas Tag HTML caption Tag HTML City tag HTML Tag HTML5 SVG HTML Event Attribute HTML5 Audio HTML5 Youtube HTML5 Button Tag HTML5 Tags

Misc

How to add JavaScript to HTML How to change font in HTML How to change text color in HTML HTML Date HTML Hide Element HTML Nested Table HTML Reset Button What does HTML stand for? HTML Background Image HTML Tag Div Tag in HTML How to insert Image in HTML How to create a link with no underline in HTML How to insert spacestabs in text using HTMLCSS HTML tag HTML Code HTML Tag HTML Canvas Design a tribute page using HTML and CSS What is a Container tag Font tag in HTML Difference between HTML and DHTML Empty Tag in HTML HTML Button Link Html Line Break Img src HTML Nested List in HTML Placeholder in HTML TD in HTML HTML Space Code HTML Target Attribute HTML Tag Markup Meaning in HTML Border-Collapse in HTML HTML Onclick Online HTML Compiler Convert HTML to PDF HTML Formatter HTML5 - Web Storage HTTP – Responses Container Tag in HTML DL Tag in HTML Horizontal Rule HTML HTML Tab Text Html Table Cell Background Color HTML Table Cell Color HTML Col Width How Many HTML Tags are There Convert String to Unicode Characters in Python HTML Runner HTML Style Attribute HTML Superscript Attribute HTML tabindex Marquee Tag in HTML HTML Dynamic Form HTML side Tag HTML Pattern Attribute HTML q Tag HTML Readonly Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line

Br Tag in HTML

What does the Tag <br> Mean?

The self-closing <br> element adds a line break when used anywhere in your code. To use the <br> tag, include it in your code anywhere you want a line break to occur.

Line breaks are inserted into text using the <br> element in HTML. Its acronym is for "Break". This tag is handy when you want to add a new line within a paragraph or other element without launching a new paragraph. There is no closing tag for the <br> element, making it an empty tag. There is no semantic significance to the <br> element. It is just used for formatting.

Example

<!DOCTYPE html>

<html>

<head>

    <title>Product Description</title>

</head>

<body>

    <p>

        Welcome to our online store! We specialize in providing high-quality <br>                 electronics and gadgets.

        Our selection includes the latest smartphones, tablets, laptops, <br> and accessories.

        Whether you're a tech enthusiast or a casual user, we have something <br> for everyone.

        Please browse our catalog and discover the perfect device <br> to fit your needs.

    </p>

</body>

</html>

Output

Welcome to our online store! We specialize in providing high-quality electronics and gadgets. Our selection includes the latest smartphones, tablets, laptops, and accessories. Whether you're a tech enthusiast or a casual user, we have something for everyone. Please browse our catalog and discover the perfect device to fit your needs.

Example 2

<!DOCTYPE html>

<html>

<head>

    <title>Form Example</title>

</head>

<body>

    <form>

        Name: <input type="text" name="name"><br><br>

        Email: <input type="email" name="email"><br><br>

        <input type="submit" value="Submit">

    </form>

</body>

</html>

Output

<br> Tag in HTML

Is It OK to Use the <br> Element in HTML?

Yes, but only after all other choices have been considered.

In a text block, a line break or a single empty line is inserted using the HTML <br> element. I advise against using <br> to establish space or structure in your writing, even if it may appear easy.

And this is the reason:

  • Lack of Semantic Meaning: In HTML, the <br> element lacks the semantic meaning of a <p> or <div> tag, which indicates a paragraph and a split part, respectively. I would characterize <br> as an "empty" element with visual but not structural importance in HTML. It is advisable to avoid <br> elements unless there is no other choice because of that issue.
  • Lack of Accessibility: <br> may not be recognized as a visual line break by assistive tools such as screen readers. Users who depend on assistive technology to browse and comprehend material may need clarification.
  • Problems with Responsiveness: <br> is a hard-coded line break that has trouble adjusting to responsive layouts or varying screen sizes. Inconsistent line spacing and readability issues may arise from the information viewed on several devices or browser windows.

These are some pointers for utilizing HTML code's <br> tags. These are "quick and dirty" methods for customizing text appearance. It would help you utilize CSS to design your text as you become more proficient with HTML.

  • Tip #1: Instead of using numerous paragraphs or other components, establish line breaks in your content using <br> tags. That may be less complicated and easier to manage.
  • Tip #2: To add more space between lines of text, use <br> tags.
  • Tip #3: To add more space between components on a website, use <br> tags. Yes, you can type <br><br><br> to brute-force the insertion of empty vertical space. It's not advised, but I won't hold it against you if you're pressed for time.
  • Tip #4: The most crucial recommended practice is to use <br> tags only when essential.

<br> Accessibility

It would help if you took care when using the <br> tag since it is known to cause accessibility issues. The following factors should be kept in mind:

  • <br> Elements may be difficult for screen readers since they need to provide a clear visual cue for a line break.
  • Regarding responsive design, <br> is a static line break that struggles to adjust. The line break generated by <br> may cause irregular spacing and layout problems when a website is viewed on various devices or screen sizes.
  • Keyboard Navigation: When employing <br> elements excessively or incorrectly, the content's logical flow and navigation might be interfered with for users who only use their keyboards to surf webpages.
  • While most contemporary assistive technologies can handle the <br> element to some degree, standard behavior for this element has yet to be established.

How Do You Interpret a Line Break?

As the name suggests, a line break is an interruption in a line. In HTML, a line break occurs when a line ends horizontally and a new line begins.

When you type a string in HTML like this:

<p> Hi, I'm attempting to make a new line. </p>

The whitespaces—the tab space before "Hello," the gap between "am" and "trying," and the space between "a" and "new"—will not be taken into consideration. That is how the outcome will look on the screen:

Hi there, I'm attempting to make a new line.

Making three <p> tags similar to this is one (albeit not very successful) technique to address this:

<p> Hello, I am</p>

<p>trying to create a</p>

<p>new line</p>

That will result in the following:

As you can see from the above result, p tags produce block elements, which fill the whole horizontal space before the following element moves to the next line.

The fact that you have three paragraphs makes this option ineffective. If a screen reader were to read this, it would read it as three paragraphs rather than just one statement. That may impact online accessibility.

Some Details on HTML and related subjects may be found here:

  1. HTML5 highlights: To enhance web development, additional elements including <header>, <footer>, <nav>, <article>, <section>, <canvas>, <video>, and <audio> were included. These components support and enhance the semantic structure of multimedia content.
  2. Use Cascading Style Sheets (CSS) to style and control the appearance and layout of HTML components. CSS features include grid layout, flexbox, animations, transitions, properties, and selectors for responsive design.
  3. Client-side scripting in web development is often implemented using programming languages such as JavaScript, which provides websites with dynamic behavior and interactivity. Among the key concepts of JavaScript are variables, data types, functions, event handling, DOM manipulation, AJAX, and ES6 capabilities.
  4. Responsive web design ensures a website appears correctly across various devices and screen sizes. Media queries, flexible images, and fluid layouts may be used to change the layout based on the device's viewport width.
  5. Website accessibility ensures that content can be accessed and used by people with disabilities. Among the elements to be considered are keyboard navigation, attention management, ARIA duties and characteristics, testing with assistive technology, and the availability of alternative text for images.
  6. SEO, or search engine optimization, is rewriting web pages to raise their search engine ranking. One may use various techniques to increase site speed, get backlinks, optimize meta tags, create excellent content, and adhere to search engine guidelines.
  7. Web development tools: There are many different tools available for web development, including text editors (like Visual Studio Code and Sublime Text), browsers with built-in developer tools (like Chrome DevTools and Firefox Developer Tools), package managers (like npm and yarn), version control systems (like Git), task runners/build tools (like Gulp and Webpack), and developer tools (like Git).
  8. Libraries and frameworks: Web development is accelerated by libraries and frameworks like jQuery, Bootstrap, Sass, React, Angular, and Vue.js, which provide pre-built components, tools, and abstractions.

Conclusion

Similar to the carriage return \n in strings, the br tag in HTML begins the following element on a new line.

Using the line break tag br rather than block elements, insert items onto new lines.

Using the br tag provides a visual line break and doesn't impact accessibility in situations such as sentences. Screen readers will read the phrase aloud without pausing.