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.)
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.
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/> .
<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.
<br>: The Line Break element. The <br> HTML element produces a line break in text (carriage-return).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With