HTML Border Around Text Only
This tutorial will show you the solution for HTML border around text only. To create a border around your text only, you can use the CSS border property which will create a border around your text by default.
Step by step for HTML border
We can give three values in the border property namely border size, border type, and border color.
<html>
<head>
<title>HTML border</title>
<script src="./jquery-3.6.1.js" type="text/javascript"></script>
</head>
<style type="text/css">
h1{
border: 2px solid red;
}
</style>
<body>
<h1>Heading Text1</h1>
</body>
</html>
Output:
1. Here, we have written the HTML basic syntax.
2. In the body, we have a <h1> tag with some text inside.
3. In the CSS Style tag, we first select h1 using the element selector then apply the border using CSS border property and assign the value 2px of thickness, solid border type, and border color red.
4. See the above output, the border is created around the text.
Conclusion
So, I hope guys, this article on HTML border helps you.