469,645 Members | 1,174 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Is it OK to put carriage returns in web form HTML view ?

Hello.

When i look at a web form in design view, i have the option to view the
HTML. Some of the HTML code is in one long string and hard to read.

Is it OK to put in carriage returns and blank lines in the HTML so that is
is easier to read ?

I'm not talking about changing the HTML code logic, just the readability of
it.

Any help would be gratefully appreciated.

Thanks,
Tony
Oct 3 '06 #1
4 1546
Sure. You can break up an HTML tag as you need to and the browser won't
care. ASP.Net tags can also be broken up to span multiple lines. For
readibilities sake, I tend not to break up in the middle of an attribute
value unless it's really lone like the text property of a control. The
browsers are designed to ignore any extra whitespace other than one space so
you could break a signle HTML tag up to take as many lines as you need such
as:

<img
src="myimage.gif"
width = "100"
height="100"
>

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello.

When i look at a web form in design view, i have the option to view the
HTML. Some of the HTML code is in one long string and hard to read.

Is it OK to put in carriage returns and blank lines in the HTML so that is
is easier to read ?

I'm not talking about changing the HTML code logic, just the readability
of it.

Any help would be gratefully appreciated.

Thanks,
Tony

Oct 3 '06 #2
Hi,

Tony Girgenti wrote:
Hello.

When i look at a web form in design view, i have the option to view the
HTML. Some of the HTML code is in one long string and hard to read.

Is it OK to put in carriage returns and blank lines in the HTML so that is
is easier to read ?

I'm not talking about changing the HTML code logic, just the readability of
it.

Any help would be gratefully appreciated.

Thanks,
Tony
A carriage return in HTML is rendered as a white space by the browser.
That can be annoying sometimes. For example if you want to place two
SPANs next to each other without any space, you cannot do this:

<span ...></span>
<span ...></span>

but you can do this:

<span ...></span><span
....></span>

If you choose carefully how to place your carriage returns, you won't
have a problem.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Oct 3 '06 #3
Thanks for your replies.

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:Oh**************@TK2MSFTNGP05.phx.gbl...
Hi,

Tony Girgenti wrote:
>Hello.

When i look at a web form in design view, i have the option to view the
HTML. Some of the HTML code is in one long string and hard to read.

Is it OK to put in carriage returns and blank lines in the HTML so that
is is easier to read ?

I'm not talking about changing the HTML code logic, just the readability
of it.

Any help would be gratefully appreciated.

Thanks,
Tony

A carriage return in HTML is rendered as a white space by the browser.
That can be annoying sometimes. For example if you want to place two SPANs
next to each other without any space, you cannot do this:

<span ...></span>
<span ...></span>

but you can do this:

<span ...></span><span
...></span>

If you choose carefully how to place your carriage returns, you won't have
a problem.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Oct 3 '06 #4
Hi,

Mark Fitzpatrick wrote:
Sure. You can break up an HTML tag as you need to and the browser won't
care. ASP.Net tags can also be broken up to span multiple lines. For
readibilities sake, I tend not to break up in the middle of an attribute
value unless it's really lone like the text property of a control. The
browsers are designed to ignore any extra whitespace other than one space so
you could break a signle HTML tag up to take as many lines as you need such
as:

<img
src="myimage.gif"
width = "100"
height="100"
>
I usually don't break attributes either, but there are notable exceptions:

<div style="color: Red;
background-color: Blue;
font-size: 2em;"

onclick="alert( 'Hello' );
alert( 'World' );">...</div>

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Oct 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Josh | last post: by
2 posts views Thread by Matt Mercer | last post: by
7 posts views Thread by mattrapoport | last post: by
3 posts views Thread by =?Utf-8?B?RGF2ZQ==?= | last post: by
11 posts views Thread by evenlater | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.