- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the correct way of using <br>, <br/>, or <br /> in HTML?
There are multiple correct ways to use a br tag in the web documents.
In HTML, a line break is made with the <br> tag. We don't need to close <br> because it's an empty tag. To break a line, either <br/> or <br></br> are acceptable.
However, <br /> tags are used in other web documents like XHTML. But the <br /> tag must possess a space before the trailing /> as it helps XHTML to render the existing HTML user agents.
Text <br> text
Following are the examples….
Example: (using <br>)
In the following example we are using <br> tag to allow break in the lines.
<!DOCTYPE html> <html> <body> <p>If you want to break a line <br> in a paragraph, <br> use the BR element in <br> your HTML document.</p> </body> </html>
On executing the above script, the text which is after the tag <br> will get automatically terminated and added to the next line.
Example: (using <br/>)
In the following example we are using <br/> tag to allow break in our lines.
<!DOCTYPE html> <html> <body> <p>If you want to break a line <br/> in a paragraph, <br/> use the BR element in <br/> your HTML document.</p> </body> </html>
When the script gets executed, the text that is after the tag <br/> is terminated and added to the next line.
- HTML <br> Tag
- What is the correct use of schema.org SiteNavigationElement in HTML?
- What is the correct way to define class variables in Python?
- What is the correct way to check if String is empty in Java?
- What is correct: widget.rowconfigure or widget.grid_rowconfigure in Tkinter?
- What is the currently correct way to dynamically update plots in Jupyter/iPython?
- What is the correct way to implement a custom popup Tkinter dialog box?
- What is the correct way to replace matplotlib tick labels with computed values?
- What is the correct way to use printf to print a size_t in C/C++?
- What is the correct way to pass an object with a custom exception in Python?
- The correct way to work with HTML5 checkbox
- The correct way to trim a string in Java.
- What is the simplest way to SSH using Python?
- What is correct syntax of Python if statement?