GetDotted Domains

Viewing Thread:
"How to end open tags"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Sat 14/11/09 at 17:09
Regular
Posts: 19,415
Hi everybody!



I like to keep my coding clean, but I find so many people doing things differently that I get confused.

For instance, I know I should close open tags like and
but what about and ? Also, should I try my best to work in lowercase or does it really make no different whatsoever?
Sat 14/11/09 at 21:58
Regular
"How Ironic"
Posts: 4,312
I'm sure cjh speaks another language.... :P You MUST be a proffessional programmer or technician or something!
Sat 14/11/09 at 19:22
Regular
"It goes so quickly"
Posts: 4,083
It depends if you're aiming for HTML or xHTML, but the likes of <br>, <img>, <meta> etc are known as "self-closing" or "empty elements" in HTML, and don't need the end slash or closing element.

HTML also has the concept of "interpreted closing", where by the use of one element is meant to automatically mean the previous element is to close:

<table>
<tr>
<td>A
<td>B
<td>C
<tr>
<td>1
<td>2
<td>3
<tr>
<td>1
<td>2
<td>3
</table>


... each new <td> implies the previous column is now closed, as does each new <tr> imply the previous row is done. This was to require less HTML code in the days of slow internet connections, small browser cache and little storage space.

xHTML, because it is a form of XML, does need these elements to be closed, as by design XML uses this strict structure.

<link [B]/[/B]>
<br [B]/[/B]>
<img [B]/[/B]>
<meta [B]/[/B]>


The space between the tag / last attribute in the element is for compatibility. If you're using another XML mark-up language (i.e. not xHTML), the closing slash should be added without a space, for example:

<elements>
<name value="Machie"[B]/[/B]>
</elements>


XML is case-sensitive, and the XML versions of HTML (xHTML) has been defined to be written in lower-case. However, if you were to create your own mark-up structure in XML, you could pick upper or lower-case letter as and where you like, such as <MyEleMent>.

As for ATOM and RSS, I'd go for one or the other, rather than both. I've gone for RSS myself, and have felt no need to worry about ATOM. Offering both can be confusing to users in my view, especially with browsers that offer direct subscriptions to feeds, and if users are offered an RSS or ATOM feed, they may not know which is the one to choose, and may become confused for no reason, or may pick both!!
Sat 14/11/09 at 18:51
Staff Moderator
"Aargh! Broken..."
Posts: 1,408
With regard to tags, single tags like the img tag should be self closed, that is <img src="images.myimage.png" with="100" height="100" alt="My image" /> if you are using a doctype that requires it, such as transitional or strict XHTML. Other tags such a the tag are made up of two parts so should have a closing part, such as <strong>This is bold</strong>.
As for RSS and ATOM, one is the alternative for the other. ATOM was developed as an alternative to RSS as it was believed RSS had some flaws so you could provide feeds in both formats just to cover yourself.
Sat 14/11/09 at 18:09
Regular
Posts: 19,415
Is the RSS and ATOM thing similar to HD DVD vs. Blu Ray? I know some sites like Wikipedia offer both and I'm concerned that I'm cutting out a portion of my readers by not offering an ATOM feed.

Should I just go with one instead of leaving it up to my users which one they want to subscribe to?
Sat 14/11/09 at 17:09
Regular
Posts: 19,415
Hi everybody!



I like to keep my coding clean, but I find so many people doing things differently that I get confused.

For instance, I know I should close open tags like and
but what about and ? Also, should I try my best to work in lowercase or does it really make no different whatsoever?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Many thanks!
You were 100% right - great support!
I am delighted.
Brilliant! As usual the careful and intuitive production that Freeola puts into everything it sets out to do. I am delighted.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.