Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Semantic HTML: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
Línia 31: Línia 31:
=== Indentation without spacer.gif ===
=== Indentation without spacer.gif ===


BAD:
<code php>
<code php>
<td class="category indentation" valign="top">
<table class="categorylist">
  <img class="spacer" src="pix/spacer.gif" alt="" height="10" width="20">
<tbody>
  <br>
  <tr>
</td>
    <td class="category indentation" valign="top">
      <img class="spacer" src="pix/spacer.gif" alt="" height="10" width="20">
      <br>
    </td>
    <td class="category name" valign="top">
      <a href="/course/category.php?id=3">Quizzes</a>
    </td>
    <td class="category number" valign="top">1</td>
  </tr>
</tbody>
</table>
</code>
 
GOOD:
<code php>
<ul>
  <li><a href="/course/category.php?id=3">Quizzes</a>1</li>
</ul>
</code>
</code>



Revisió del 06:47, 9 juny 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

    BAD:

    <tbody> </tbody>
         <img class="spacer" src="pix/spacer.gif" alt="" height="10" width="20">
         
         <a href="/course/category.php?id=3">Quizzes</a>
    
    1

    GOOD:

    • <a href="/course/category.php?id=3">Quizzes</a>1

    (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