473,803 Members | 4,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1683
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.gi f"
width = "100"
height="100"
>

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

"Tony Girgenti" <tony(nospam)@l akesideos.comwr ote in message
news:%2******** ********@TK2MSF TNGP05.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*********@bl uewin.chwrote in message
news:Oh******** ******@TK2MSFTN GP05.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.gi f"
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1794
by: Guy Verville | last post by:
I'm perplexed, I have several forms that seem to be ok, but what is sent by email doesn't contain all the Carriage returns sent. The form contains many fields and is sent as follow:...
4
7324
by: Les Juby | last post by:
Can someone please help with a suggestion as to how I can keep the formatting (carriage returns) that the user enters into a memo field and then display that later. I figured I might be able to use: 'replace carriage returns with BRs comment=Replace(comment, chr(13), "<br>") but obviously net.! The <pre> tag doesn't sem to help either as the embedded return is
4
18702
by: Josh | last post by:
Hi, I'm using System.Data.DataSet.ReadXml to convert some xml from a webservice to a DataSet. The xml looks like: <?xml version="1.0" encoding="UTF-8"?><root><prioritiesTable><description>blah blah blah blah</description></prioritiesTable></root> The important thing here is the which I beleive should be a single
2
2953
by: eagleofjade | last post by:
I am trying to import data from a Word document into an Access table with VBA. The Word document is a form which has various fields. One of the fields is a field for notes. In some cases, this note field contains carriage returns. When I import a note field that has carriage returns, what shows up in the Access field are vertical black lines where the carriage return should be.
2
2340
by: Matt Mercer | last post by:
Hi all, I am having a frustration problem, and I have read about 25 newsgroup postings that do not have a satisfying answer :) The problem appears to be common where carriage returns are lost when pulling data from an SQL database. The thing that frustrates me the most, is that when I use Enterprise Manager, the carriage returns ARE THERE. It looks fine until I pull it out.
7
11210
by: mattrapoport | last post by:
I have a page with a div on it. The div displays a user comment. When the user logs into this page, their current comment is pulled from a db and displayed in the div. The user can edit the comment through a pop-up that contains a textarea. When the user hits OK on the pop-up, the text in the textarea is sent to a function on the main page. The function inserts the text into the div's text node. Please don't ask why I'm making this...
2
4656
by: GregBeagle | last post by:
Windows XP I have a simple form from which I want to generate an email with the contents of the form. I use carriage returns to format the content for readability. When I test it on my computer the email generated by getURL("mailto..") is fine in my email client. Carriage returns are kept etc and shows how I want it. However when I upload it to the server and run it on the web, the carriage returns are stripped out of the text and all...
3
2473
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm trying to download a webpage by using the HttpWebRequest. It returns the html source, however, it contains "\r\n", "\t" etc throughout the text. Is there a way to return the same HTML as when I navigate to the url in the browser and do a "View Source"? Or do I have to manually strip these out? The full code is below where I'm posting the necessary data to simulate a form post. HttpWebRequest req =...
11
12606
by: evenlater | last post by:
My db allows the user to send email via CDO. The body of the email is determined in code. I have built an email form with To, CC and Subject lines and a large text box for the body of the message so the user can edit the default email message body before sending the message. But when I populate the large text box (txtBody), I can't get it to include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10) and Chr(13). I've got the...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.