link sizes Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:link

Description

The sizes attribute specifies the sizes of icons for visual media.

This attribute is only used if rel="icon".

Attribute Values

ValueDescription
HeightxWidth Specifies one or more sizes for the linked icon.
any Specifies that the icon is scalable (like an SVG image)

Examples:

  • <link rel="icon" href="favicon.png" sizes="16x16" type="image/png"> (1 size)
  • <link rel="icon" href="favicon.png" sizes="16x16 32x32" type="image/png"> (2 sizes)
  • <link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml"> (any size)

The following code shows how to set Icon with specified size:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
  <link rel="icon" href="https://www.java2s.com/style/demo/Opera.png" type="image/gif" sizes="16x16">
</head><!--from w ww.j a v  a  2s.  c om-->
<body>

<h2>Hello world!</h2>
<p>Open this page in a <a href="https://www.java2s.com/style/demo/Opera.png" target="_blank">new window</a> to see the favicon.</p>


</body>
</html>

Related Tutorials