內容導向網頁應用程式前端的無障礙設計
透過集合功能整理內容 你可以依據偏好儲存及分類內容。
可存取的網頁應用程式設計是提供良好的使用者體驗,以及提升整體應用程式使用者滿意度的關鍵要素。易於存取的網頁應用程式可確保來自不同地理位置的使用者和擁有不同能力的人都能享有平等的體驗。使用者的聽覺、認知、語音或視覺能力有其限制,以及與短期身心障礙、網路連線速度較慢或日照明亮度有相關暫時限制的使用者,應該都能存取您的網頁應用程式。建構網頁應用程式的前端時,建議您從一開始就運用無障礙解決方案,避免發生無障礙問題,也不需要在建構過程中再次執行任何工作。請確保應用程式內容能由網路檢索器和螢幕閱讀器掃遍,同時為使用者提供良好的體驗。
無障礙設計是許多國家/地區和產業的法律義務;您必須瞭解這些規範,並將無障礙解決方案整合至前端設計。不同的業務案例也突顯了網路內容無障礙性的重要性。
MDN 和 WCAG 等資源提供基本指南和建議,協助您提升網頁應用程式的無障礙功能。您也可以前往 web.dev 參加「學習無障礙功能」課程。
為了讓各種使用者都能存取網頁應用程式,各種元件之間的交互作用是相當重要的一環。
色彩和對比
色彩使用是評估網頁應用程式無障礙功能的主要因素。前端使用者必須能夠察覺網頁上的內容,而色彩和對比必須明顯影響使用者對內容的觀感。檢視條件和視力相關的身心障礙可能是暫時性、情境式或永久性,但建構網頁應用程式前端時必須考慮這些情況。在使用者端介面所使用的顏色之間,建立正確的對比度或亮度差異,可以讓多樣化的使用者更容易存取您的網頁應用程式。對比度可以提供背景與文字之間的亮度差異。
如要測量對比,可以使用對比度公式,確保背景中的文字或圖示存在最小對比度。考慮到許多形式的色彩感知障礙,但新的色彩模型即使以灰階顯示,仍可確保系統正確辨識內容。
為了提供無障礙功能,通常建議使用深色主題。由於白色淺色和閱讀障礙,通常在視覺輸入中通常會優先選用深色主題。由於內容導向應用程式含有大量文字和圖片,因此請務必謹慎使用顏色和對比度,以滿足使用者多元的需求。
進一步瞭解 web.dev 的顏色和對比。
字體排版
字體排版是指文字選擇和排列方式,讓多樣化的使用者能夠判讀且清楚易讀。最常變更的無障礙設定是裝置的預設字型大小。部分使用者可能想用更小的字型大小來在螢幕上容納更多文字,或是盡可能放大文字,因此,設定彈性且易讀的字體排版非常重要。此外,個別文字字元也應該能讓讀者清楚區分,而且整體文字必須清晰易讀。在應用程式的前端設計期間,請務必選取同時具有易讀性和可讀性的字體。
字體
您為網頁應用程式選擇的字體 (或字型系列) 應該要能讓廣大的讀者都能輕鬆存取。字體是應用程式文字中所用字母的視覺設計。許多研究說明在評估網頁內容的無障礙程度時,字體的重要性。必須在品牌、使用者介面設計目標和易讀性之間取得平衡,才能讓更多使用者更輕鬆地使用您的應用程式。建構前端時,請考慮字型選項與其中的字型選項如何影響應用程式的無障礙功能和整體設計。
字型大小
考慮允許瀏覽器縮放功能,協助低視能或色覺障礙失明的使用者。網頁應用程式的文字字型必須能讓多元讀者看見。如要調整字型大小,可以從 px
切換為 rem
。Rem 單位可讓您使用與 Wep 應用程式根元素相對的字型大小。這種方式多變,可提升網頁應用程式整體的無障礙功能。
結構和版面配置
各種結構和版面配置屬性會影響介面的無障礙功能。要考慮的版面配置功能包括文字區塊間距和對齊方式,以及文字行與單字母之間的空間。利用格線,以視覺化方式呈現設計中要納入的元件。內容的版面配置和結構應該引人入勝,並讓使用者享受愉快的體驗。對部分使用者來說,複雜的版面配置或含有多個文字區塊的繁忙背景,例如使用 ADHD 的螢幕。請務必在前端設計程序中,將多元包容性列為優先要務。
ARIA 和 HTML
可存取性豐富的網際網路應用程式 (ARIA) 包含一套指南和屬性,有助於讓使用者更輕鬆地使用網頁應用程式。ARIA 能輔助 HTML,並啟用可存取的 JavaScript 小工具、即時內容更新和錯誤訊息等。正確使用 ARIA 是為了讓網頁應用程式更易於存取的關鍵。未正確使用 ARIA 會導致錯誤發生,實際上會讓使用者較不容易存取您的應用程式。
請盡可能使用 ARIA 標籤來導入與點字和文字轉語音 (TTS) 相容的替代格式。如果 ARIA 角色和標籤與背景樹狀結構不同,可讓您變更無障礙樹狀結構。使用非標準標記 (例如 div
做為可點選按鈕) 時,這些標籤也很重要。如果 HTML 元素不支援無障礙功能,就必須提供 ARIA。設計內容導向應用程式時,請確保螢幕閱讀器和其他輔助裝置受到完善支援,有助於應用程式盡可能觸及最多使用者。
進一步瞭解 web.dev 上的 ARIA 和 HTML。
國際化
國際化是指設計網頁應用程式,供不同語言及文化背景的使用者存取。您的網頁應用程式應該要能根據不同語言、地理區域和文化偏好進行調整,不需要大幅變更程式碼。國際化的關鍵要素包括多語言支援、本地化、內容區隔、日期和時間格式、文字方向、語言協商等等。
只要將網頁應用程式國際化,就能為世界各地的使用者打造多元包容且容易使用的服務。對擁有多元使用者數量或目標實現國際擴展的任何網頁應用程式而言,國際化是不可或缺的一環。
邏輯屬性
在 CSS 中建構樣式時,請務必使用 start
/ end
,而非 top
/ down
/ left
/ right
等屬性。這可確保選單和網站版面配置為 RTL 語言隨之調整。
替代內容
在 HTML 標記中加入 lang
屬性,並在標頭中加入替代文件的連結,以便提供內容的自訂標記。這樣一來,如果定義的語言與預設瀏覽器語言不同,瀏覽器就能選取正確的網頁。這項工具可協助網路瀏覽器和搜尋引擎瞭解網頁的語言,這不僅有助於正確轉譯內容,也能提高 SEO 成效。
國際
JavaScript 中的 Intl
物件是建立多語言和文化感知網頁應用程式的重要工具。這項工具可為網頁應用程式提供國際化和本地化功能,可確保您的介面和內容容易理解,並因文化而異。Intl 物件提供的功能包括日期和時間格式、數字格式和字串定序。
進一步瞭解 web.dev 的國際化功能。
HTML 表單是內容導向網頁應用程式的重要環節。可讓使用者進行互動,並提供結構化方法收集使用者資訊。如果一般大眾都無法存取 HTML 表單,可能會讓使用者感到困擾並感到不滿。
如要讓 HTML 表單變得易於存取,請針對所有表單欄位使用語意 HTML 元素。 這有助於輔助技術瞭解每個欄位的用途,讓使用者更容易完成欄位。此外,請務必為所有表單欄位清楚加上標籤。這可協助使用者提供準確且實用的資訊。此外,測試 HTML 表單的無障礙程度也很重要,方法是使用輔助技術模擬使用者的使用者體驗,而使用者需要這類技術使用應用程式內容。
進一步瞭解如何在 web.dev 上建構表單。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eAccessible web applications ensure equal access for people with diverse abilities and across various locations by addressing auditory, cognitive, speech, and visual limitations.\u003c/p\u003e\n"],["\u003cp\u003eIncorporating accessibility solutions from the initial design phase is crucial to avoid rework and ensure compatibility with web crawlers, screen readers, and user experience.\u003c/p\u003e\n"],["\u003cp\u003eColor and contrast, typography, structure, layout, ARIA attributes, and internationalization are key elements to consider for creating inclusive web applications.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing semantic HTML, ARIA labels, and the \u003ccode\u003eIntl\u003c/code\u003e object enhances accessibility and supports assistive technologies for broader user reach.\u003c/p\u003e\n"],["\u003cp\u003eDesigning accessible HTML forms with clear labels and semantic elements is essential for seamless user interaction and information gathering.\u003c/p\u003e\n"]]],["Accessible web application design is crucial for diverse users, including those with disabilities. Key actions include utilizing accessibility solutions from the start, ensuring content is traversable by web crawlers and screen readers, and complying with legal guidelines. Color and contrast, typography, layout, and structure should be optimized. ARIA and semantic HTML enhance accessibility for assistive technologies. Internationalization, including multilingual support and localization, ensures a global user-friendly experience. Accessible HTML forms that use semantic elements and clear labels improve user interactions.\n"],null,["Accessible web application design is a key component to providing a positive\nuser experience and overall application user satisfaction. An accessible web\napplication ensures equal access to people with diverse abilities and for people\nacross various geographic locations. People with limitations relating to their\nauditory, cognitive, speech, or visual abilities and temporary limitations\nrelating to short-term disabilities, slow internet connection, or even bright\nsunlight should be able to access your web application. When building the\nfrontend of your web application, utilize accessibility solutions right from the\nstart to prevent accessibility issues and the need to redo any work later during\nthe build process. Make sure that your application content can be traversed by\nweb crawlers and screen readers while also providing a positive user experience\nfor users.\n\nAccessibility is a legal obligation in many countries and industries; you must\nunderstand these guidelines and incorporate accessibility solutions into your\nfrontend design. Various business cases highlight the importance of\naccessibility for web content as well.\n\nResources such [MDN](https://developer.mozilla.org/) and\n[WCAG](https://www.w3.org/WAI/standards-guidelines/) provide\nessential guidelines and suggestions for increasing accessibility of your web\napplication. You can also take the [Learn\nAccessibility](https://web.dev/learn/accessibility)\ncourse on web.dev.\n\nThe interdependence among various components is an essential aspect of making a\nweb application accessible to diverse users.\n\nColor and contrast\n\nColor use is a primary factor in assessing the accessibility of a web\napplication. Frontend users must be able to perceive the content on the page,\nand color and contrast considerably impact users' perception of content. Viewing\nconditions and sight-related disabilities can be temporary, situational, or\npermanent, but must be considered when building the frontend of your web\napplication. Creating the correct contrast or difference in brightness between\ncolors used on the user-facing interface can make your web application more\naccessible to diverse users. The contrast ratio provides the difference in\nbrightness between the background and text.\n\nTo measure contrast you can use the [contrast ratio\nformula](https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio) to make\nsure a [minimum\ncontrast](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)\nexists for the text or icons on the background. There are many forms of\ncolor-perception disabilities to consider, but new color models can ensure\ncontent is perceived correctly even if viewed in grayscale.\n\nUtilizing a dark theme is often recommended to support color and contrast for\naccessibility. Dark themes are often preferred for visual input due to white\nlight and reading difficulties. Since content driven applications include a\nlarge amount of text and images, it is crucial for you to use color and the\ncontrast ratio wisely to meet the diverse needs of your users.\n\n[Learn more about color and contrast on\nweb.dev](https://web.dev/learn/accessibility/color-contrast/).\n\nTypography\n\nTypography refers to text choice and arrangement so that it is readable and\nlegible to diverse users. One of the most changed accessibility settings is the\ndefault font size on devices. Some users may want to fit more text on the screen\nwith a smaller font size or make the text as big as possible Therefore, making\nthe typography size flexible and legible is very important. Individual text\ncharacters should also be distinguishable to the reader, and the overall text\nshould be legible to read. During the frontend design of your application, be\nsure to select typefaces that include both legibility and readability.\n\nTypeface\n\nThe typeface, or font family, that you choose for your web application should be\nvisually accessible to a wide range of readers. The typeface is the visual\ndesign of the letters used in the text of your application. [Many\nstudies](http://dyslexiahelp.umich.edu/sites/default/files/good_fonts_for_dyslexia_study.pdf)\ndescribe the importance of typeface when assessing the accessibility of web\ncontent. Finding the balance between the brand, your user interface design goals\nand the ease of reading makes your application more enjoyable for a wider range\nof users. When building your frontend, consider how the typeface options as well\nas the font options within them, contribute to the accessibility and overall\ndesign of your application.\n\nFont size\n\nConsider allowing for browser zoom to help users that have low vision or color\nperception disabilities blindness. The font of the text on your web application\nmust be visible to diverse readers. Font size variations can be achieved by\nswitching from `px` to `rem`. Rem units allow for a font size that is relative\nto the wep application's root element. This is a versatile option that would\nincrease your web application's overall accessibility.\n\nStructure and layout\n\nVarious structural and layout properties affect the accessibility of your\ninterface. Layout features to consider include text block spacing and alignment\nas well as the space between text lines and even individual letters. Utilize\ngrids and visualize the components you would like to include in your design. The\nlayout and structure of the content should be engaging and enjoyable for users\nto consume. Complex layouts or busy backgrounds with multiple text blocks might\nbe difficult for some users, such as those with\n[ADHD](https://www.cdc.gov/ncbddd/adhd/data.html)to use. Be sure to\nprioritize inclusivity during your frontend design process.\n\nARIA and HTML\n\nAccessible Rich Internet Applications (ARIA) includes a set of guidelines and\nattributes to help make web applications more accessible for users. ARIA\nsupplements HTML and enables accessible JavaScript widgets, live content\nupdates, and error messages, among others. Correct use of ARIA is essential to\ntruly make your web application more accessible. Incorrect use of ARIA can lead\nto errors and actually make your application less accessible to users.\n\nUse\n[ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA)\nlabels when possible to introduce alternative formats compatible with braille\nand text-to-speech (TTS). ARIA roles and labels let you change the accessibility\ntree when it differs from the dom tree. These labels are also important when\nusing non standard tags such as a `div` being used as a clickable button. ARIA\nis required when an HTML element does not have accessibility support. When\ndesigning your content-driven application, make sure that screen readers and\nother assistive devices are well supported to aid your application in reaching\nas many users as possible.\n\n[Learn more about ARIA and HTML on\nweb.dev](https://web.dev/learn/accessibility/aria-html/).\n\nInternationalization\n\nInternationalization refers to designing a web application to be accessible to\nusers from different linguistic and cultural backgrounds. Your web application\nshould adaptable to different languages, geographic regions, and cultural\npreferences without substantial code changes. Key components of\ninternationalization include multilingual support, localization, content\nseparation, date and time formatting, text direction, and language negotiation,\namong others.\n\nBy internationalizing your web application, you can create an inclusive and\nuser-friendly experience for a wide global audience. Internationalization is\nessential for any web application with a diverse user base or goal of\ninternational expansion.\n\nLogical properties\n\nWhen building out styles in CSS make sure to use `start` / `end` instead of\nproperties like `top` / `down`/ `left`/ `right`. This ensures that menus and\nsite layouts shift accordingly for RTL languages.\n\nAlternate content\n\nInclude the\n[`lang`](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/lang)\nattribute on the HTML tag with links to alternative documents in the header to\nprovide custom markup for your content. This lets the browser select the correct\npage if the defined language differs from the default browser language. It can\nhelp web browsers and search engines understand the language of the page, which\nis important for rendering the content correctly and for effective SEO.\n\nIntl\n\nThe\n[`Intl`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)\nobject in JavaScript is an important tool for creating multilingual and\nculturally aware web applications. It provides internationalization and\nlocalization capabilities in web applications, and ensures that your interface\nand content are understandable and culturally appropriate for users around the\nglobe. Features provided by the Intl object include date and time formatting,\nnumber formatting, and string collation.\n\n[Learn more about internationalization on\nweb.dev](https://web.dev/learn/design/internationalization/).\n\nForms\n\nHTML forms are a critical part of content driven web applications. They enable\nuser interaction and provide a structured method to gather user information. If\nHTML forms are not accessible to a wide audience, they can lead to frustration\nand dissatisfaction for users.\n\nTo make HTML forms accessible, use semantic HTML elements for all form fields.\nThis helps assistive technologies understand the purpose of each field and make\nit easier for users to complete them. Also, be sure to label all form fields\nclearly. This helps users provide accurate and useful information. It is also\nimportant to test the accessibility of your HTML forms; this can be done by\nusing assistive technologies to simulate the experience of a user that requires\nsuch technologies to consume your application's content.\n\n[Learn more about building forms on\nweb.dev](https://web.dev/learn/accessibility/forms/)."]]