/

HTML / CSS / JavaScript Tutorial

HTML Element: <center>

[this page | pdf | back links]

The HTML <center> element was used to indicate centred text. It is not supported in HTML 5. Instead, use CSS.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<center>text</center>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var x = document.createElement("CENTER");
x.textContent = "text";
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile