Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Semantic HTML.

Semantic HTML: Difference between revisions

From MoodleDocs
Line 8: Line 8:


Instead of writing something like
Instead of writing something like
=== List instead of DIVs ===


<code php>
<code php>
Line 25: Line 27:
</code>
</code>


(Examples taken from Moodle's Site Administration block.)
(Example taken from Moodle's Site Administration block.)
 
=== Indentation without spacer.gif ===
 
<code php>
<td class="category indentation" valign="top">
  <img class="spacer" src="pix/spacer.gif" alt="" height="10" width="20">
  <br>
</td>
</code>
 
(Example from Moodle's Course Category list.)


For more examples how to make Moodle HTML more semantic you might have a look at this work in progress: [[User:Frank Ralf/Semantic HTML1]].
For more examples how to make Moodle HTML more semantic you might have a look at this work in progress: [[User:Frank Ralf/Semantic HTML1]].

Revision as of 06:45, 9 June 2009

The case for semantic HTML

It is easy to create HTML that works, but current best practice suggests that creating valid and Semantic HTML is an important goal for various reasons including usability and accessibility.

Unfortunately, while validation is a relatively easy task to understand and achieve, creating semantically correct HTML is a lot more subjective and open to debate.

Examples for semantic HTML

Instead of writing something like

List instead of DIVs

 <a href="#" name="d16">
   <img id="vh_div16indicator" src="pix/closed.gif" alt="Closed folder">
     Security
 </a>

you better write this (with some accompanying CSS):

  • <a href="#">Security</a>
  • (Example taken from Moodle's Site Administration block.)

    Indentation without spacer.gif

     <img class="spacer" src="pix/spacer.gif" alt="" height="10" width="20">
     

    (Example from Moodle's Course Category list.) For more examples how to make Moodle HTML more semantic you might have a look at this work in progress: Frank Ralf/Semantic HTML1.

    Further resources

    Online:

    Books:

    See also