I Wish HTML div Elements Didn’t Force Line Breaks

Once again, I was bitten by the annoying feature that div elements in HTML have forced line breaks in them. I was looking at the JSON output of a servlet I had created and was trying to figure out why there were CRLF line breaks in the data stream for one column of data but not another. I tried calling trim() on the data, and the results, and still I got the line breaks. I was really stumped, and then I looked at the addition of the CSS class to the strings and noticed that I had used a div for the one column and a label for the other!

That was it. Duplicate the CSS on a label tag, switch the div to a label and all of a sudden I was getting the data I expected.

Duh!

But Holy Cow! Who decided that div elements needed line breaks when the others didn't? Clearly someone with an evil sense of humor.