Early Access

Meta Tags

default-style

Learn how to use the default-style meta tag to improve your site.

Specifies the name of the preferred stylesheet to use on a web page. This allows users or user agents to choose the default stylesheet amongst many provided.

Code Examples

<meta http-equiv="default-style" content="Main Style" />
Correct use case where "Main Style" is precisely the title of one of the page’s alternative stylesheets.
<meta http-equiv="default-style" content="incorrectTitle" />
Mismatched title, leading to no stylesheet being selected as default because "incorrectTitle" does not match any stylesheet titles.

Recommendations

  • Correctly Name Stylesheets
    Ensure the name provided in the "default-style" meta tag exactly matches one of the titles in the linked stylesheets. Case sensitivity matters.
  • Use With Multiple Stylesheets
    This tag is most beneficial when multiple stylesheets are provided, each with a unique title attribute. It directs which stylesheet is automatically selected.

Related Documentation

Related Meta Tags

Defines which dynamic resources are allowed to load, thus helping to prevent cross-site scripting attacks, data injection, and other malicious attempts to exploit web page vulnerabilities.

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://apis.google.com;">
Allows scripts, styles, and images to load from the site's own origin and scripts from Google APIs, tightening security by restricting external resources.

content-type

http-equiv

Defines the MIME type and character encoding for the HTML document. It sets the character set used for the HTML document, which is crucial for correctly displaying text.

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
This example specifies the HTML document type with UTF-8 character encoding, ensuring correct text display and maximum compatibility.

default-style

http-equiv

Specifies the name of the preferred stylesheet to use on a web page. This allows users or user agents to choose the default stylesheet amongst many provided.

<meta http-equiv="default-style" content="Main Style">
Correct use case where "Main Style" is precisely the title of one of the page’s alternative stylesheets.

refresh

http-equiv

Used to redirect the user to a new URL after a certain number of seconds, or to refresh the current page. While it can be useful for redirecting users or refreshing content, its usage is generally discouraged in favor of server-side redirects or JavaScript for a better user experience and performance.

<meta http-equiv="refresh" content="5;url=http://example.com">
Redirects the user to "http://example.com" after 5 seconds, giving a brief moment to read any important information before the redirect.

X-UA-Compatible

http-equiv

Advises the web browser to display the webpage in compatibility view or a specific version of Internet Explorer. Primarily used to instruct Internet Explorer to use its Edge rendering engine.

<meta http-equiv="X-UA-Compatible" content="IE=edge">
Instructs Internet Explorer to use the latest available rendering engine, ensuring more modern, standards-compliant HTML & CSS features are used.