Can I use enter or line break to separate HTML attributes within an HTML tag?
For example:
<input
type="text"
name="usrnm"
placeholder="Username"
/>
Can I use enter or line break to separate HTML attributes within an HTML tag?
For example:
<input
type="text"
name="usrnm"
placeholder="Username"
/>
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.
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.