: Can HTML tags contain new lines within the tag between attributes? Can I use enter or line break to separate HTML attributes within an HTML tag? For example: <input type="text"
Can I use enter or line break to separate HTML attributes within an HTML tag?
For example:
<input
type="text"
name="usrnm"
placeholder="Username"
/>
More posts by @Cody1181609
2 Comments
Sorted by latest first Latest Oldest Best
Yes. It is perfectly functional. Extra spaces, tabs and newlines don't really affect HTML, but it will almost always annoy the hell out of your coworkers. Don't do that.
Although it is not completely conventional (in terms of industry standards for the markup language), it will function. Just put your example into a .html file:
<html>
<head>
<title>
Page
</title>
</head>
<body>
<input
type = "text"
name="usrnm"
placeholder="Username"
/>
</body>
</html>
You'll notice that this does render correctly.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.