Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<br> instead of <br/> in Visual Studio

I use Visual Studio for teaching HTML. We use HTML 4.01 Transitional. Visual Studio defaults to XHTML 1.0, and I need to solve one problem with a typical difference among these two HTML standards: Whenever we enter <br> or <hr>, it is automagically changed to <br /> or <hr /> respectively. This is great for XHTML, but unwanted when working in HTML 4.01 mode.

So how to turn off this automagical feature? We use mainly Visual Studio 2010, and sometimes also 2012 and 2008.

(I know how to easily switch validation to HTMl 4.01 mode, but it still puts slashes to each <br>, <hr> etc.)

like image 907
Al Kepp Avatar asked Oct 23 '12 13:10

Al Kepp


People also ask

Should I use br or br />?

It is an empty tag i.e. no need to add an end tag. Writing <br> tag is perfectly fine. Let's see the usage of other br tags i.e. <br/> or <br />, In HTML, use <br> tag.

Should I use BR or BR?

If you are outputting HTML on a regular website you can use <br> or <br/> , both are valid anytime you are serving HTML5 as text/html. If you are serving HTML5 as XHTML (i.e. content type application/xhtml+xml, with an XML declaration) then you must use a self closing tag like so: <br/> .

What is the difference between BR and br />?

<TAG_NAME> indicates the beginning of a tag, and </TAG_NAME> indicates the end of a tag. When a tag is used with nothing between it, then a self-closing, or null tag can be used, which combines the beginning and end.

What does br /> mean?

<br>: The Line Break element. The <br> HTML element produces a line break in text (carriage-return).


1 Answers

Tools -> Options -> Text Editor -> HTML -> Formatting -> Tag Specific Options

You may define behavior for each individual tag. Hit CTRL + K + D to reformat the document and you should see the change.

Specific Tags

enter image description here

Alternative Method (All Tags)

enter image description here

like image 183
Tim M. Avatar answered Oct 13 '22 08:10

Tim M.