2013-03-21 53 views
5

我正在開發的網站的要求是它必須符合508規定。目前,我們的大部分HTML視圖都以標題h1開頭,然後在該視圖上需要什麼。現在對於表單,建議在處理無障礙性時使用fieldset s和legend s,以及其他許多指導原則。這使事情變得更加複雜一些,因爲h1是內容的標題,但如果我必須使用fieldset和一個圖例,現在我有一個h1標題,但圖例標題幾乎是相同的。例如:輔助功能,字段集標誌和標題標記

<h1>Edit Education Details</h1> 

    <form> 
    <fieldset> 
     <legend>Edit Education Details</legend> 

     <p> 
     <label for="school">School</label> 
     <input id="school" name="school" type="text"/> 
     </p> 

     ...other fields 

    </fieldset>  
    </form> 

我不確定要走哪條路線。我是否應該擺脫h1,並將其風格與h1造型相同?或者我應該對傳奇文字進行創意,以便它們不是完全相同的文字?提前致謝。

回答

5

h1保留原樣(假設教育詳細信息是您可以在該屏幕上編輯的唯一東西),並使用fieldset/legend將任何相關表單控件分組。舉例來說,假設你有一系列與教育用戶的級別處理複選框完成:

<h1>Edit Education Details</h1> 

<form> 

<p> 
    <label for="school">School</label> 
    <input id="school" name="school" type="text"/> 
</p> 
<fieldset> 
    <legend>Level of Education Completed</legend> 
    <input type="checkbox" id="highschool"> 
    <label for="highschool">High School</label> 
    <input type="checkbox" id="associates"> 
    <label for="associates">Associates Degree</label> 
    [...] 
</fieldset>  
</form> 

如果沒有的形式輸入的任何邏輯關聯的部分,則省略fieldset/legends。擁有冗餘或「獲得創造力」以便不會造成冗餘,不會增強可訪問性。

請參閱WCAG 2.0 - H82: Grouping form controls with FIELDSET and LEGEND

+0

是的,我和h1一起去了,你的意見很有道理。感謝您的鏈接。 – ryanulit 2013-03-22 02:24:05