HTML Element: <br>
[this page | pdf | back links]
The
HTML <br> element indicates a single
line break (c.f. a carriage return). In XHTML, it needs to be ‘properly’ closed
as per <br />.
The attributes
it can take are HTML
global attributes and HTML event attributes.
To create or access such
an element in JavaScript
see here. The
corresponding HTML DOM object
supports standard
DOM properties and methods. The default style applicable to this element is
shown here.
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
Text broken using a carriage return between here <br> and here
<br><br>Created using JavaScript:<br>
<span id="element"></span>
<script>
var y = document.getElementById("element");
var txt1 = document.createTextNode("Text broken using a carriage return between here ");
y.appendChild(txt1);
var x = document.createElement("BR");
y.appendChild(x);
var txt2 = document.createTextNode(" and here");
y.appendChild(txt2);
</script>
</body>
</html>
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Elements