Mobile app version of vmapp.org
Login or Join
Cody1181609

: 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"

@Cody1181609

Posted in: #Html

Can I use enter or line break to separate HTML attributes within an HTML tag?

For example:

<input
type="text"
name="usrnm"
placeholder="Username"
/>

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Cody1181609

2 Comments

Sorted by latest first Latest Oldest Best

 

@Shelton105

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.

10% popularity Vote Up Vote Down


 

@Mendez628

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme