C:\ Home » 2012 (Page 8)

What Does The XML Declaration Do?

The doctype is obviously needed, but what the XML declaration? Why would that be required?

I looked around, and it's not. Without an XML declaration, the default for a XHTML document is XML 1.0 and UTF-8. UTF-8 is the standard, and XML 1.0 is used for XHTML 1.0, so if you are using XHTML v1.0 (which is the only version you can use for regular websites, since XHTML v1.1 doesn't serve as text/html) and the UTF-8 standard, there's no need for it!

So, save space and get rid of it if you're stuck in the habit. Or if you use a program like Dreamweaver to create and edit pages that automatically adds the declaration at the top of the page. It's actually better to omit than to include, since it can cause issues with IE 6, which is still, unfortunately, a commonly used browser on this planet.

Double Quotes With <q>

I read recently, that back in 2008 you could get double quotation marks in Firefox if you added quotations within a <q> tag, since FireFox generated them by default, whereas IE (the most popular browser back then) didn't output any quotes at all. So people either added quotation marks or didn't, and they would appear either without quotations in IE and with quotations in FF, or with quotations in IE and with double quotations in FF. The end result of this problem was that many designers stopped using the <q> tag to avoid any issues. The question is, is this still a problem today? The article was written at the time of IE 6, and it seems IE 8 has the same problem. Don't know about latter versions though. Maybe it's already fixed.

If not, I suppose the best option would be to create a stylesheet reset so that browsers can't add anything unwanted to your page, then you add the quotations, or not, as you wish. Here's another quick workaround I found which you could add to your CSS file:

q:before, q:after {
  content: "";

When adding a quote, you would then need to add quotation marks outside the <q> opening and closing tags for them to appear. If you don't want quotation marks, you wouldn't need to do anything, this CSS would get rid of them, on all browsers. Just so you know, this is how inline quotes appear here at CDB.

The DFN Tag

The <dfn> element is for special terms.

Ever used the <dfn> tag? It stands for definition. It's used to introduce or explain a specific key term within a document. If I was writing a tutorial about HTML, and I was just going to start explaining what HTML was, then I could use the <dfn> tag like this: HTML is...

The tag may include common attributes, such as title (which I did not use above). An even better choice might be to include it within another tag, such as <acronym>, and use that tag to define a title. In the example above that would probably be much better since HTML is an acronym as well as a key term in the document.

But still, wouldn't the regular acronym or abbr tags suffice for introducing new terms? Where would a dfn tag find a greater purpose? I wonder if this tag will get deprecated in future XHTML versions.

Difference Between Acronym & Abbreviation

Two tags that I've been using more and more over the years are <acronym> and <abbr>. Well actually, <acronym> is the only one I've really been using. Sometimes I type in acronyms manually, but for the most part I have a script that parses a specified set of acronyms and adds a title attribute to them so they show up like this: HTML, XHTML, NG, CDB, WWW, ETC. I have about a hundred acronyms listed, and they're all acronyms, I think... so when is the abbreviation tag actually used?

It turns out an acronym is a term that is formed from the initial letters of a longer word or phrase, is pronounced differently from the original and can be pronounced as a word. NASA is an example of an acronym. An abbreviation, on the other hand, is pronounced (at least partially) the same as it's initial form, though it is written differently, such as Mr. instead of Mister. In fact, the ETC I have included above is not only an acronym, but also an abbreviation for Etcetera. The tool-tip displayed for ETC is really for the abbreviated version, not for the words that E T & C really stand for as an acronym. Most words can be abbreviated, as can places, dates and names. Beth, for example, is an abbreviation of Elizabeth, but most probably you won't need to add an <abbr> tag for names. I mean, if you call your friend Beth, why would you need to explain to the world, through a tool-tip, what her real name is? As for Bob (I am so called), it's one of few names that is both an acronym and an abbreviation. Or is it? Can Bob really be an abbreviation of Robert? With Beth, the name is a shortened yet similarly pronounced version of Elizabeth, but with Bob and Robert the similarities are much less! With Bobby, though, it's clearly an abbreviation.

To complicate matters a bit, there are also initialisms. All the acronyms I've listed above (except for ETC) are actually initialisms. They are much like acronyms in that they are made from the first letter in a string of words, yet they cannot be pronounced as a word. Yet there is thankfully no tag for initialisms, so they are logically grouped as acronyms, as they are certainly not abbreviations. So, to sum things up, acronyms are made from the first letters in a string of words, abbreviations are shorted forms of words, and the majority of acronyms are really initialisms, acronyms that cannot be pronounced as a new word. Also, acronyms are a subset of abbreviations, so all acronyms are really abbreviations, but not always vice versa!

Did you get any wiser? ;)

Relearning The Basics

I've known HTML, XHTML and CSS since back in 2003-2004, and since then I've been constantly teaching myself new things, eventually adding to that static-coding knowledge with PHP, SQL, flash and JS as well. Along the way I started working with scripts like phpBB and punBB and WordPress, and whaddayaknow, I became a pro. :)

At least that's what I thought, but then I bought myself a real book (800 pages) for a university course I'm reading, about web-design basics, and apparently (it shouldn't be so surprisingly) there's a lot that I've missed! New realizations pop up all the time, along with questions and curiosities, as I learn things that would have made life so much easier when I first started designing. Like the fact that <blockquote> can't be inside a <p> because they're both block elements, or that <span> is inline and <div> is block, and that's why you can't put a <div> within a sentence. How did I survive without such fundamental knowledge earlier? Learning things from the ground up is probably the best method.

I decided to start up a new category to post bits of code and revelation that might be useful to know. Hopefully they'll come in handy now and again. And if your looking to learn the basics yourself, the book Beginning Web Programming with HTML, XHTML, and CSS by Jon Duckett is much recommended! It's not just for the newbies, but for anybody who wants to learn the language properly. So far it's been fun to read, too, and I've learned the best recipe in the world for scrambled eggs. Haven't had time to test it yet, though. ;)

Soon Christmas

Time is just flying by. Why am I, so caught up in stuff, high in time! Maybe it's cause of all these calenders I'm following? :D They remind me how little time there is left, and still, I haven't won anything! Dangit! Maybe today...

COOPs Calender

But anyway, everything else is going fine. If I finish one assignment each day (not counting the two grand holiday days coming up) I'll be done with all my studies before the year and have time left for a couple of weeks of well-earned vacation before the new semester starts. I make it sound easy, though, the typical assignment is like a 5-page essay or a full website design. But yeah, that's what's keeping me busy... apart from all these advent calenders. So no snow to behold on CDB as is the tradition of old... this year. For now. For later! And a Merry Christmas in advance!

Privacy   Copyright   Sitemap   Statistics   RSS Feed   Valid XHTML   Valid CSS   Standards

© 2019
Keeping the world since 2004.