Consider a typical scenario for web page design. Key is designing the logo, or title of the page. It will have various requirements. Unfortunately, these requirements cannot all be met under the current HTML specifications, and, as a practical matter, compromises must be made.
The requirements:
- • The title of the page must be displayed in a large format near the top of the web page. Call this the "Page Title."
• The Page Title must display as an image in browsers that are image-enabled. It may display as text on limited browsers. A graphical image is necessary, however, for owners of a trademarked logo, or any organization that wants to establish an official presence on the Internet. For example, a web surfer who visits the FBI web site expects to see the FBI insignia (an image) on the front page. That expectation must be fulfilled.
• The Page Title must display. It must display regardless of whether images, CSS, or both are enabled or disabled by the user agent/browser. There must be only one Page Title displayed.
• Clicking the Page Title should lead to the root of the site or some other URL that the page designer deems useful, such as http://example.com/ or http://example.com/blog.
• The Page Title should be enclosed in the h1 element. This is semantically important. It helps search engines determine what page addresses which topic. All HTML structural elements must have meaning. The h1 element must not be empty. The text of the Page Title must be in the h1 element. This is semantically important as well. Automated agents, such as search engines can use the Page Title text to determine the topic of the page. Thus, it is insufficient to simply put the Page Title text in the alt attribute of an img tag which in turn is inside an h1.
• The solution must not use a span element. No hacks.
• The solution must not use the CSS properties: display: none; visibility: hidden; font-size: 0; or otherwise use CSS to hide, conceal, or obscure any information contained in the HTML. These techniques cause problems for search engines and readers that need to distinguish legitimate, well-maintained sites from those sites that include spam keywords not relevant to the site, and link farms. Furthermore, the use of these properties cause problems for screen readers and accessibility.
• Site authors should have the option of making the Page Title image partially transparent. The CSS property "opacity” should be usable with this image. The site author should be able to use a non-opaque logo if desired. Yet, partial transparency is not an option if the site author relies on certain image replacement hacks.
• The solution must not rely on JavaScript.
Possible implementations that fulfill all of these requirements in the current HTML 5 spec: none. The consequence is that site authors must compromise.
There is a vital need for "Page Title" as specified above. This need has inspired numerous hacks. A sampling of the rich, muddy ecosystem attempting to deal with this design flaw would include Fahrner Image Replacement, CSS image replacement, and more. Oftentimes, using CSS to specify a "background" image is used, even though the intent is that the "background" image becomes the main content.
http://css-tricks.com/nine-techniques-for-css-image-replacement/
http://annevankesteren.nl/2003/08/html-headers
http://www.evotech.net/blog/2007/09/css-image-replacement-method/
To address this great, common need, HTML 5 should have a new element, noimg. The contents of a noimg element are displayed only in one situation. They only display if images on the browser are disabled. This includes browsers that do not display any images.
If the browser is displaying images, the contents of the noimg element are ignored by the browser. If the browser is not displaying images, the contents of the noimg element are displayed. This enables the following implementation.
- Code: Select all
<h1>
<a href="/">
<img src="logo.png" alt="" />
<noimg>
The Page Title
</noimg>
</a>
</h1>
This simple HTML allows all of the above requirements to be met. Search engine bots will be able to easily access the plain text Page File, contained in the h1, and in turn contained in the noimg. Web designers could easily implement the site logo in HTML, and would not have to make the compromises of today.
There is no functionality in HTML 5 or CSS that the noimg element would duplicate. Furthermore, even implementing JavaScript that detects whether the user agent is displaying images is apparently non-trivial.
HTML 5 will include the noscript element, for browsers that do not have JavaScript enabled. HTML 5 should have a counterpart element for browsers that do not have images enabled. It is a simple, logical step.
By way of technical details, the attributes for the proposed noimg are the same as they are for noscript.
Counterargument: Some may say that this could be used illegitimately to spam search engines. For example, to attract more hits from search engines to a web site, the web site might have a noimg element with various common search terms that are irrelevant to the site. Furthermore, link farms could try to use the noimg element to hide links, intending to influence search engine rank. The thought is that users wouldn't see the spam links, but search engine bots would.
Counter-counterargument: Users browsing with images disabled would see the search terms and link farms. This would greatly injure the site's reputation. As a result, sites will regulate themselves and not abuse the noimg element.
For example, A business such as a law firm might consider putting spam terms on its web site in a noimg element, intending to increase the search hits it receives. These spam terms might be "Britney Spears, Octomom, American Idol." The law firm would be embarrassed, however, when asked by a paying client why they saw those terms on their law firm's web site when browsing via smartphone. Therefore, to avoid this embarrassment, the law firm, or other business, would not abuse the noimg element in this way, and if they did, they would pay the price in lost reputation and lost revenue.
Search engines could implement an algorithm to deny any "link popularity" based on any links contained within a noimg element. For example, if a link farm had a link to a pharmaceutical middle-man hidden in a noimg tag, a search engine might ignore this, degrade the site's popularity, or blacklist it.
Today link farms could theoretically use the noscript element to hide massive collections of spam links from people's eyes, while making them visible to search engine bots. Yet, there is no controversy over the noscript element's inclusion in HTML 5.
The benefit from a noimg element would greatly outweigh any problems it would cause.
An alternative
Finally, let's consider an alternative proposal and why it probably would not work. The proposal would be to add src, height, width, href, and other related attributes to h1-h6. If the src attribute is present in an h1 element, and the image is successfully downloaded by the browser, and the browser has images enabled, the browser would display the image from the src attribute, and the browser would not display the content of the element. In any other situation, the browser displays the content of the element, and not the src image. Thus the solution would be as follows.
- Code: Select all
<h1 src="logo.png" height="100" width="300" href="/">
The Page Title
</h1>
Counterargument: It would be very difficult for browsers to implement this. This alternative proposal is not viable. The noimg element proposal is superior.
In conclusion, the noimg element would receive wide browser support, would be used heavily, would benefit the WorldWide Web greatly, would assist web designers significantly, and would make the job of search engines easier. The noimg element would be a good addition to HTML 5.