Forum Moderators: open

Message Too Old, No Replies

line breaks in HTML code

line breaks meta

         

webaster

12:26 pm on Jun 18, 2005 (gmt 0)

10+ Year Member



<code>
<meta name="keywords" content="keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword">
</code>

If using line breaks can these cause parsing errors as seen in the above code example.

Should all be set as one line without linebreaks or does it not matter. I only know line-breaks differ in Windows, mac , Unix? But in this case we have a metatag will it cause any faults?

webaster

12:28 pm on Jun 18, 2005 (gmt 0)

10+ Year Member



<code>
<meta name="keywords" content="keyword, keyword
, keyword, keyword, keyword, keyword, keyword,
keyword, keyword, keyword">
</code>

The above example has linebreaks althought they are invisble ...

tedster

12:14 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe a validator will throw an error if an open quote is not followed with a close quote before a line break. Check your page out here:

W3C Validator for HTML [validator.w3.org]

Although lots of programs that read your code may recover from that error, I would still suggest avoiding it - especially because this break occurs within a quoted attribute value. Why take any chances?

webaster

11:03 am on Jun 19, 2005 (gmt 0)

10+ Year Member



There a different sorts of line-breaks for windows,mac and unix or linux.

If the pages are being served on apache server and the pages were edited on a unix machine=mac osx.

Does this not elliminate the problem of linebreaks?

webaster

11:06 am on Jun 19, 2005 (gmt 0)

10+ Year Member



the W3C validator does validate the page as valid HTML4.01 strict - there is doctype, char encoding included in HTML

Nonetheless when doing another check with a validator of a certain HTML validator it did signal that the linebreaks as an error.

webaster

11:07 am on Jun 19, 2005 (gmt 0)

10+ Year Member



HTML validator should be HTML editor

webaster

11:07 am on Jun 19, 2005 (gmt 0)

10+ Year Member



it did signal that the linebreaks as an error.

should be

it did signal the linebreaks as an error.

g1smd

10:56 am on Jun 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Line breaks should not be a problem. What was the exact error message?

webaster

11:21 am on Jun 20, 2005 (gmt 0)

10+ Year Member



the exact error message wa simply that linebreaks occured in the metatags between the double quoted keywords.

same here goes for javascript -there you use ; for a linebreak.

the whole idea is that the keywords should stay as a whole between those double quotes.

Sure it is no problem the browser does read over those linebreaks.

Just I think you better practise writing clean code and avoid linebreaks.