473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Typing Markup Tags Ending in />

I often use self-closing tags (such as <br/>) when creating an ASP.NET
application. However, when I enter them in Visual Studio .NET 2005, it
automatically inserts a space before the />. In most cases this does not
bother me, but for tags such as <br/that I usually do not use any
attributes with I prefer not to have the extra space. I there a way to
prevent Visual Studio .NET 2005 from inserting the extra space before the />
at the end of the tag? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Dec 30 '06 #1
14 1232
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eJ**************@TK2MSFTNGP03.phx.gbl...
I there a way to prevent Visual Studio .NET 2005 from inserting the extra
space before the /at the end of the tag?
Do you *really* want your code to be non XHTML-compliant and non
cross-browser compatible...?
http://www.w3schools.com/xhtml/xhtml_howto.asp
Dec 30 '06 #2
Is <br/really non XHTML-compliant? Visual Studio .NET might try to create
<br /instead, but it doesn't mark my tags with a warning or anything. I
didn't think getting rid of the space before the / was breaking the rules of
XHTML. Is it?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eJ**************@TK2MSFTNGP03.phx.gbl...
>I there a way to prevent Visual Studio .NET 2005 from inserting the extra
space before the /at the end of the tag?

Do you *really* want your code to be non XHTML-compliant and non
cross-browser compatible...?
http://www.w3schools.com/xhtml/xhtml_howto.asp

Dec 30 '06 #3
[ Excessive newsgroup list trimmed in this reply. ]

Nathan,
I didn't think getting rid of the space before the / was breaking the
rules of XHTML. Is it?
No need to worry, it is OK to both include or leave out the space before the
"/>" characters.

From the XML 1.1 specification (XHTML is based on XML) published by W3C:

http://www.w3.org/TR/xml11/#sec-starttags

....you may find definition #44, which defines an empty tag like <BRas
follows:

EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'

Here, "Name" is the name of the tag, i.e. "BR", and "S" stands for a white
space, like a space or tab (one or more). At the end, there's "S?" and
followed with the "/>" characters. The question mark after the "S" is an
occurrence indicator, and means that the white space can exist, or not exist
at all.

So, both "<BR/>" and "<BR />" are correct as far as the specification goes,
but the latter might be a bit easier to read (subjective) whereas the former
takes little less space.

Happy New Year!

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Dec 30 '06 #4
"Nathan Sokalski" <nj********@hotmail.comwrote in
news:eJ**************@TK2MSFTNGP03.phx.gbl:
I often use self-closing tags (such as <br/>) when creating an ASP.NET
application. However, when I enter them in Visual Studio .NET 2005, it
automatically inserts a space before the />. In most cases this does
not bother me, but for tags such as <br/that I usually do not use
any attributes with I prefer not to have the extra space. I there a
way to prevent Visual Studio .NET 2005 from inserting the extra space
before the /at the end of the tag? Thanks.
You wouldn't want to do this. It is merely following the XHTML
standards.

Martin
Dec 30 '06 #5
"Nathan Sokalski" <nj********@hotmail.comschrieb:
Is <br/really non XHTML-compliant?
No, it is valid XHTML.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 30 '06 #6
You wouldn't want to do this. It is merely following the XHTML
standards.
Umm...

According to the W3C Markup Validation Service http://validator.w3.org/ both
<br/and <br /compliant XHTML 1.1!

Remember the w3.org is the group that defines the standard.

--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Martin Milan" <I8**@m.i.dowrote in message
news:Xn**********************@194.117.143.37...
"Nathan Sokalski" <nj********@hotmail.comwrote in
news:eJ**************@TK2MSFTNGP03.phx.gbl:
>I often use self-closing tags (such as <br/>) when creating an ASP.NET
application. However, when I enter them in Visual Studio .NET 2005, it
automatically inserts a space before the />. In most cases this does
not bother me, but for tags such as <br/that I usually do not use
any attributes with I prefer not to have the extra space. I there a
way to prevent Visual Studio .NET 2005 from inserting the extra space
before the /at the end of the tag? Thanks.

You wouldn't want to do this. It is merely following the XHTML
standards.

Martin
Dec 30 '06 #7
Do you *really* want your code to be non XHTML-compliant and non
cross-browser compatible...?
http://www.w3schools.com/xhtml/xhtml_howto.asp
Unfortunately w3shcools.com is *not* the authority on internet standards.

Remember that http://www.w3.org is the group that defines the standard. I
would rely on w3.org for the authority on internet standards. Then rely on
other groups, such as w3shcools.com, for quirks (pun intended) that specific
browsers exhibit.

According to the W3C Markup Validation Service http://validator.w3.org/ both
<br/and <br /are compliant XHTML 1.1!

In fact the XHTML 1.0 Recommendation uses <br/(no space) in their
examples! (heading 4.6 Empty Elements)

http://www.w3.org/TR/xhtml1/

Further depending on how old the howto page is, it may be totally
immaterial! What percentage of users, of the OP's web site, actually use
Netscape. What percentage of their users, use a version of Netscape that
exhibits the problem.

--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eJ**************@TK2MSFTNGP03.phx.gbl...
>I there a way to prevent Visual Studio .NET 2005 from inserting the extra
space before the /at the end of the tag?

Do you *really* want your code to be non XHTML-compliant and non
cross-browser compatible...?
http://www.w3schools.com/xhtml/xhtml_howto.asp
Dec 30 '06 #8
Nathan,
As Herfried suggests <br/is valid XHTML.

I normally use the W3C Markup Validation Service http://validator.w3.org/ to
verify compliant XHTML.

--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:uv***************@TK2MSFTNGP02.phx.gbl...
Is <br/really non XHTML-compliant? Visual Studio .NET might try to
create <br /instead, but it doesn't mark my tags with a warning or
anything. I didn't think getting rid of the space before the / was
breaking the rules of XHTML. Is it?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eJ**************@TK2MSFTNGP03.phx.gbl...
>>I there a way to prevent Visual Studio .NET 2005 from inserting the
extra space before the /at the end of the tag?

Do you *really* want your code to be non XHTML-compliant and non
cross-browser compatible...?
http://www.w3schools.com/xhtml/xhtml_howto.asp

Dec 30 '06 #9
Jay,

"Jay B. Harlow" <Ja************@tsbradley.netschrieb:
I normally use the W3C Markup Validation Service http://validator.w3.org/
to verify compliant XHTML.
I prefer Christoph Schneegans' validator because it provides more accurate
results (it validates against XML schemas):

XML Schema Validator
<URL:http://schneegans.de/sv/>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 30 '06 #10
[ Excessive newsgroup list trimmed in this reply. ]

Nathan,

It is one of the last things I would make a point from so I am not sure if
it is in it.
(That does not mean that you should do the same as me).

If you are working in Source View and you have the workbar HTML selected
than there is a dropdownbox where you can select what kind of HTML code you
want use, maybe it is between one of those those.

Cor

"Nathan Sokalski" <nj********@hotmail.comschreef in bericht
news:eJ**************@TK2MSFTNGP03.phx.gbl...
>I often use self-closing tags (such as <br/>) when creating an ASP.NET
application. However, when I enter them in Visual Studio .NET 2005, it
automatically inserts a space before the />. In most cases this does not
bother me, but for tags such as <br/that I usually do not use any
attributes with I prefer not to have the extra space. I there a way to
prevent Visual Studio .NET 2005 from inserting the extra space before the
/at the end of the tag? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Dec 30 '06 #11
Thanks for the link, I've saved a copy for future reference.

--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:en*************@TK2MSFTNGP06.phx.gbl...
Jay,

"Jay B. Harlow" <Ja************@tsbradley.netschrieb:
>I normally use the W3C Markup Validation Service http://validator.w3.org/
to verify compliant XHTML.

I prefer Christoph Schneegans' validator because it provides more accurate
results (it validates against XML schemas):

XML Schema Validator
<URL:http://schneegans.de/sv/>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 30 '06 #12
Nathan Sokalski wrote:
I often use self-closing tags (such as <br/>) when creating an ASP.NET
application. However, when I enter them in Visual Studio .NET 2005, it
automatically inserts a space before the />. In most cases this does not
bother me, but for tags such as <br/that I usually do not use any
attributes with I prefer not to have the extra space. I there a way to
prevent Visual Studio .NET 2005 from inserting the extra space before the />
at the end of the tag? Thanks.
If you select the menu "Tool" | "Options" and then select "Text Editor"
- "HTML" - "Format" (in the left hand pane) and then click the "Tag
specific Options" button, you will then see "Default Settings" -
"Client does not support contents", which will allow you to choose how
such tags are handled.

However there doesn't appear to be any option for removing the space. I
am inclined to take that as hard coded in VS2005

The form <br /is not a requirement for XHTML but the space is
recommended for backward compatability with HTML:

http://www.w3.org/TR/2002/REC-xhtml1-20020801/#xhtml

See paragraph C.2. Empty elements

Jan 2 '07 #13
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eJ**************@TK2MSFTNGP03.phx.gbl...
:
: I often use self-closing tags (such as <br/>) when creating an
: ASP.NET application. However, when I enter them in Visual Studio
: .NET 2005, it automatically inserts a space before the />. In
: most cases this does not bother me, but for tags such as <br/>
: that I usually do not use any attributes with I prefer not to
: have the extra space. I there a way to prevent Visual Studio
: .NET 2005 from inserting the extra space before the /at the
: end of the tag? Thanks.

I believe this goes back to some older browsers (earlier netscape
browsers, if memory serves) that would not render <br/or <hr/>
correctly without the interveneing space character.

Ralf
--
--
----------------------------------------------------------
* ^~^ ^~^ *
* _ {~ ~} {~ ~} _ *
* /_``>*< >*<''_\ *
* (\--_)++) (++(_--/) *
----------------------------------------------------------
There are no advanced students in Aikido - there are only
competent beginners. There are no advanced techniques -
only the correct application of basic principles.
Jan 2 '07 #14
There are options on how to handle the set of tags that includes <br />
there, but I could not find anywhere that lets you specify whether or not to
include the space. The only option I could find that actually changed the
tag itself was the Closing Tag option, which is basically choosing between
<br /and <br>, and given that choice I definitely would choose <br />. Did
I miss the section you were talking about? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Phil H" <go****@philphall.me.ukwrote in message
news:11**********************@i12g2000cwa.googlegr oups.com...
Nathan Sokalski wrote:
>I often use self-closing tags (such as <br/>) when creating an ASP.NET
application. However, when I enter them in Visual Studio .NET 2005, it
automatically inserts a space before the />. In most cases this does not
bother me, but for tags such as <br/that I usually do not use any
attributes with I prefer not to have the extra space. I there a way to
prevent Visual Studio .NET 2005 from inserting the extra space before the
/>
at the end of the tag? Thanks.

If you select the menu "Tool" | "Options" and then select "Text Editor"
- "HTML" - "Format" (in the left hand pane) and then click the "Tag
specific Options" button, you will then see "Default Settings" -
"Client does not support contents", which will allow you to choose how
such tags are handled.

However there doesn't appear to be any option for removing the space. I
am inclined to take that as hard coded in VS2005

The form <br /is not a requirement for XHTML but the space is
recommended for backward compatability with HTML:

http://www.w3.org/TR/2002/REC-xhtml1-20020801/#xhtml

See paragraph C.2. Empty elements

Jan 4 '07 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jan K. | last post by:
Hi there, I have edited some php-source (a Stringychat 'shoutbox' on the webpage) By default, all the text was not marked up at all. I have tried to markup the text, and succeeded partly. Can...
3
by: Michal A. Valasek | last post by:
Hello, I want to transform text with HTML markup to plain text. Is there some simple way how to do it? I can surely write my own function, which would simply strip everything with < and >....
14
by: Nathan Sokalski | last post by:
I often use self-closing tags (such as <br/>) when creating an ASP.NET application. However, when I enter them in Visual Studio .NET 2005, it automatically inserts a space before the />. In most...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.