Structure Archive

The Friendliest Link Targets in the Neighborhood

Posted on June 20, 2007 in Structure by Jeff Starr

[ Image: Fred Rogers with Shoe ] The target attribute for anchor elements (<a>) specifies the location in which the referenced document should load. For example, to open a link in a new window, we would use a target value of _blank. Although this is a commonly employed technique, the target attribute has been deprecated by the W3C and is not valid (X)HTML. Regardless, the target element remains a useful tool for practicing designers and developers. Here, we present the attribute values for the target element:

Continue Reading

URL Character Codes

Posted on February 19, 2007 in Function, Structure by Jeff Starr

URL’s frequently employ potentially conflicting characters such as question marks, ampersands, and pound signs. Fortunately, it is possible to encode such characters via their escaped hexadecimal ASCII representations. For example, we would write "?" as "%3F". Here are a few more URL character codes (case-insensitive):

Continue Reading

Feed your Image via Atom or RSS

Posted on February 4, 2007 in Function, Structure by Jeff Starr

This quick tutorial explains how to add images to both Atom and RSS feeds. Although both formats allow for image-inclusion, feed-reader support for image-display is currently quite limited. Hopefully, that will change in the near future..

Images for Atom Feeds

Images included within Atom feeds must have a ratio of either 1:1 or 2:1. There are no other restrictions as to file type or size. Use the <icon> XML element for URL’s targeting 1:1 images. Otherwise, use the <logo> XML element for URL’s targeting 2:1 images. Either element should be placed in the <feed> element:

<feed>
   <icon>http://domain.tld/path/icon.ico</icon>
   <logo>http://domain.tld/path/logo.gif</logo>
</feed>

Continue Reading

Embed Flash and Video via the object Tag

Posted on January 29, 2007 in Accessibility, Structure by Jeff Starr

Embed Windows Media Player via the object tag

Here is the general format for including .wmv files in web pages:

<object type="video/x-ms-wmv" data="http://www.domain.com/path/to/winmovie.wmv" width="340" height="280">
  <param name="src" value="http://www.domain.com/path/to/winmovie.wmv" />
  <param name="controller" value="true" />
  <param name="autostart" value="true" />
</object>

Continue Reading

Embed External Content via iframe and div

Posted on January 2, 2007 in Structure by Jeff Starr

By using an <iframe> within a <div>, it is possible to include external web content in most any web document. This method serves as an excellent alternative to actual frames, which are not as flexible and definitely not as popular. Indeed, with CSS, the placement, sizing, and styling of div’s provides endless possibilities for embedding external or even internal web content into pages that would otherwise require the use of frames, Flash, or JavaScript. This method works on any modern browser, as well as any old browser that understands both <div> and <iframe> tags. Simply add the following code to your document and style according to your specific needs:

<div style="position:absolute; left:77; top:77; width:377; height:377; clip:rect(0,381,381,0); background:#FFF;">

 <iframe src="http://www.google.com/" width="377" height="377" marginwidth="0" marginheight="0" frameborder="no" scrolling="yes" style="border-width:2px; border-color:#333; background:#FFF; border-style:solid;">
 </iframe>

</div>

Here is the code again, this time commented with explanatory information:

Continue Reading

Exploring the (X)HTML Link Element

Posted on October 31, 2006 in Structure by Jeff Starr

Most Web authors are familiar with the <link> element included within the <head> element of many (X)HTML documents. The <link> element enables authors to associate external resources to the (X)HTML document. <link> element references include various types of metadata, navigation, and styling information. This brief post provides examples of these and other important uses of the (X)HTML <link> element.

<!-- indicate the starting location -->
<link rel="start" href="http://domain.com/directory/" />

<!-- indicate the previous item -->
<link rel="prev" href="http://domain.com/directory/prev/" />

<!-- indicate the next item -->
<link rel="next" href="http://domain.com/directory/next/" />

<!-- indicates the index location -->
<link rel="contents" href="http://domain.com/directory/index.html" />

<!-- indicates location of a help file -->
<link rel="help" href="http://domain.com/directory/help.html" />

<!-- indicates location of a site feed -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://domain.com/directory/feed.rdf" />

<!-- indicates location of FOAF metadata -->
<link rel="meta" type="application/rdf+xml" title="FOAF" href="http://domain.com/directory/foaf.xrdf" />

<!-- provides contact information -->
<link rev="made" href="mailto:name@domain.com" title="contact name" />

<!-- indicates location of translated document -->
<link rel="alternate" href="http://domain.com/directory/translated.html" hreflang="fr" title="french translation" />

<!-- provides a link to the stylesheet -->
<link rel="stylesheet" href="http://domain.com/directory/style.css" type="text/css" media="screen" />

Absolutely Centered Layout

Posted on September 18, 2006 in Presentation, Structure by Jeff Starr

Absolute Centering with CSS & (X)HTML

Designing an absolutely centered layout involves centering a division both horizontally and vertically. When this is done, the centered division (or other element) is centered according to the browser window. To accomplish this, use this (X)HTML:

<div id="wrapper">
 <div id="center">
 </div>
</div>

And employ this CSS (commented with explanations):

Continue Reading

Fun with Downlevel Conditional Comments

Posted on September 4, 2006 in Function, Structure by Jeff Starr

Ever since Internet Explorer 5 (IE5), Microsoft has included browser support for "downlevel conditional comments," a non-scripted method of browser detection. Downlevel conditional comments (DCC) are a useful tool for targeting directives to specific versions of Internet Explorer. Downlevel conditional comments consist of an opening statement and a closing statement. Taken together, the statements enclose markup, CSS, JavaScript, or any other element typically included within an (X)HTML document. The DCC may be placed anywhere within the document and executes its contents only for the version(s) of IE specified. This technique is useful for delivering IE-specific stylesheets exclusively to specific versions of IE. Unfortunately, the last line of a DCC may invoke validation errors, but fortunately, there is a fix. This article describes the code and techniques used when including downlevel conditional comments in web documents.

Continue Reading

XHTML Document Header Resource

Posted on August 30, 2006 in Structure by Jeff Starr

This XHTML header tags resource is a work in progress, perpetually expanding and evolving as new information is obtained, explored, and integrated. Hopefully, you will find it useful in some way. Even better, perhaps you will share any complimentary or critical information concerning the contents of this article.

Table of Contents

Continue Reading

HTML Frames Notes Plus

Posted on August 29, 2006 in Structure by Jeff Starr

If you think that nobody uses frames anymore, think again. I personally know of one person who threw down some tuf HTML frame action for a personal site. So, in the interest of prosperity, we are hereby establishing this post as our official dumping ground for all HTML frame-related garbage.

Break your pages out of someone else’s frames

We begin our journey with a totally sick JavaScript method for breaking pages out of the illegitimate frames of some ineffectually pathetic bastard:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

   if (window.self ! = window.top) window.top.location = window.self.location;

//--><!]]>
</script>

Likewise, here is an equally effective method that should work in all JS-enabled browsers:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if (window.frames) {
   if (parent != self) {
   location.href="index.html"
   }
}

//--><!]]>
</script>

Alternatively, this method also works well in all non-NN browsers:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if (parent.frames.length > 0) {
   parent.location.href = location.href;
}

//--><!]]>
</script>

Here is a similar version of the previous method:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if (parent.frames.length > 0) top.location.replace(document.location);

//--><!]]>
</script>

Here is yet another slightly similar version:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if (top.frames.length > 0) {
   top.location = self.location;
}

//--><!]]>
</script>

Yet another fine method for breaking out of frames:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if ( top.location != document.location.href ) { 
   top.location = document.location.href; 
}

//--><!]]>
</script>

Here is the script we use for Monzilla Media (monzilla.biz):

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if ( self.location.href != top.location.href ) {
   top.location.href = self.location.href;
}

//--><!]]>
</script>

This method stops recursively framed pages:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

if ( window != top ) 
   top.location.href = window.location.href;

//--><!]]>
</script>

This method works great at breaking out and redirecting the browser to the original page:

<script type="text/javascript">
<!--//--><![CDATA[//><!--

var parent_location = new String(parent.location);
   if ( ( top.location != location ) && parent_location.indexOf('http://domain.tld/path/to/page.html') != 0 )
   top.location.href = document.location.href;

//--><!]]>
</script>

Optimize the content of an iframe

Moving right along, here is a helpful method for optimizing the content of an iframe. This code basically displays a link to the content that should be displayed if everything is working correctly. If for some reason the content is not displayed, the link will appear in its place, thereby enabling users to access the missing content via a new window:

<iframe src="page.html" width="333" height="333" scrolling="auto" frameborder="1">
   <a href="page.html" target="_blank">
      [Your browser does not support frames or is configured not to display frames. Click here to visit the related document.]
   </a>
</iframe>

Control frameborder and scroll attributes for iframes via CSS

To control the frameborder=”value” and scroll=”yes/no” attributes for iframes using CSS, add the following styles to the document which is being displayed in the iframe:

<style type="text/css">
html, body {
   overflow: hidden;
   border: none;
}
</style>

This method works on all IE 4+ with the following exceptions:

IE 4

  • Ignores overflow on html and body elements (i.e., no scrollbar elimination in IE 4)
  • Border property must be applied to the body element

IE 5 and IE 5.5

  • Overflow property must be applied to the body element
  • Border property may be applied to either the html or the body element

IE 6 / Quirks Mode (Transitional DTD)

  • Overflow property must be applied to the body element
  • Border property may be applied to either the html or the body element

IE 6 / Standards Mode (Transitional DTD)

  • Overflow property must be applied to the html element
  • Border property must be applied to the html element

Stylish Deleted Text

Posted on May 2, 2006 in Structure by Jeff Starr

Fashion stylish deleted text in XHTML via the über obscure del tag.

Code example:

<del datetime="1999-Dec-31T23:59:59+00:00" 
title="Text deleted: 31-Dec-1999 @ 23:59">
 Terminate me.
</del>

Live example:

Terminate me.

Obscure XHTML Tags

Posted on April 3, 2006 in Structure by Jeff Starr

Well, maybe not that obscure..

  • <pre> — Preformatted character data
  • <em> — Renders as emphasized text
  • <strong> — Renders as strong emphasized text
  • <tt> — Renders font as teletype or monospace
  • <dfn> — Defines a definition term
  • <code> — Defines computer code text
  • <samp> — Defines sample computer code
  • <kbd> — Defines keyboard text
  • <var> — Defines a variable
  • <cite> — Defines a citation
  • <strike> — XHTML Transitional only
  • <del> — Indicates deleted text
  • <ins> — Indicates inserted text
  • <dl> — Defines a definition list
  • <dt> — Defines a definition term
  • <dd> — Defines a definition definition
  • <abbr> — Defines an abbreviation
  • <acronym> — Defines an acronym
  • <address> — Specifies an address
  • <q> — Indicates inline quoted text
  • <bdo dir="rtl"> — Override the bidirectional algorithm
  • <wbr> — Word break, applied by IE and Fx if needed
  • <optgroup> — Labels groups of options in select boxes