Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have attribute values that span multiple lines?

Tags:

html

e.g.

<div class="big             left             important"> some content </div> 

Does anyone know if this breaks things / has good browser support?

like image 226
jon Avatar asked Jul 27 '11 22:07

jon


People also ask

Can attributes have spaces?

External JavaScript And, of course, any data-* attribute value can contain spaces that are meaningful (including leading and trailing spaces) so those spaces have to be reflected when accessing the element using that attribute value.

Are line breaks allowed in XML?

XML does not require a specific form of line break, so you can use whatever is convenient (carriage return, linefeed, or a combination) when creating an XML file. XML parsers will do the right thing largely because they're parsing on tags, not records - so whatever line break you're using is just whitespace to XML.


1 Answers

Returns, tabs, etc are considered white space and should be treated the same. I've seen and done formatting similar to how you have posted it. Some may discourage it. But I've never seen anything choke on it.

When creating my own web robots, I've had to clean up the white space in order for them to function because ultimately the robot runs into examples such as yours.

like image 140
Wayne Avatar answered Sep 22 '22 23:09

Wayne