For iframe elements in XML documents, the srcdoc attribute, if present, must have a value that matches the production labeled document in the. Dans votre application, utilisez une balise iframe> pour définir l’URL src. All data-param-* attributes will be added as query parameter to the YouTube iframe src. This may be used to pass custom values through to YouTube plugins, .
|Published (Last):||24 December 2015|
|PDF File Size:||11.56 Mb|
|ePub File Size:||9.65 Mb|
|Price:||Free* [*Free Regsitration Required]|
To embed an image in HTML, when there is only a single image resource, use the img element and with its src and alt attributes. However, there are a number of situations for which the author might wish to use multiple image resources that the user agent can choose from:. The users’ zoom level might be different from one another, or might change for a single user over time. A user might zoom in to a particular image to be able to get a more detailed look.
The zoom level and the screen pixel density the previous point can both affect the number of physical screen pixels per CSS pixel. This irfame is usually referred to as device-pixel-ratio.
The users’ screen bslise might be different from one another, or might change for a single user over time. The users’ network speed, network latency and bandwidth cost might be different from one another, or might change for a single user over time.
Paramètres du lecteur
A user might be on a fast, low-latency and constant-cost connection while at work, on a slow, low-latency and constant-cost connection while at home, and on a variable-speed, high-latency and variable-cost connection anywhere else. Bzlise might want to show the same image content but with different rendered size depending on, usually, baluse width balose the viewport.
This is usually referred to as viewport -based selection. Authors might want to show different image content depending on the rendered size of the image. This is usually referred to as art direction. Authors might want to show the same image content but using different image formats, depending on which image formats the user agent supports. This is usually referred to as image format-based selection.
The above situations are not mutually exclusive.
For example, it is reasonable to combine different resources for different device-pixel-ratio with different resources for art direction. While it is possible to solve these problems using scripting, doing so introduces some other problems:. With this in mind, this specification introduces a number of features to address the above problems in a declarative manner.
The src and srcset attributes on the img element can be used, using the x descriptor, to provide multiple images that only vary in their size the smaller image is a scaled-down version of the bigger image.
The x descriptor is not appropriate when the rendered size of the image depends on the viewport width viewport-based selectionbut can be used together with art direction. This balsie result in something useful though perhaps lower-resolution than the user would like being displayed even in older user agents. For new user agents, the src attribute participates in the resource selection, as if it was specified in srcset with a 1x descriptor. The srcset and sizes attributes can be used, using the w descriptor, to provide multiple images that only balsie in their size the smaller image is a scaled-down version of the bigger image.
The user agent will bakise the effective pixel density of each image from the specified w descriptors and the specified rendered size in the sizes attribute. In new user agents, the src attribute is ignored when the srcset attribute uses w descriptors. In this example, the sizes attribute could be omitted because the default value is vw.
The sizes attribute sets up the layout breakpoints at 30em and 50emand declares the image sizes between these breakpoints to be vw50vwor calc 33vw – px. These sizes do not necessarily have to match up exactly blaise the actual image width as specified in the CSS. For example, if the viewport width is 29emthen max-width: If the viewport width is instead 32emthen max-width: Notice that the slightly wider viewport results in a smaller image because of the different layout.
The user agent can then calculate the effective pixel density and choose an appropriate resource similarly to the previous example. The picture element and the source element, together with the media attribute, can be used, to provide multiple images that vary the image content for intance the smaller image might be a cropped version of the bigger image.
The user agent will choose the first source element for which the media query in the media attribute matches, and then choose an appropriate URL from its srcset attribute.
The rendered size of the image varies depending on which resource is chosen. To specify dimensions that the user agent can use before having downloaded the image, CSS can be used. The type attribute on the source element blise be used, to provide multiple images in different formats. In this example, the user agent will choose the first source that has a type attribute with a supported MIME type. Jframe the user agent supports WebP images, the first source element will be chosen.
If neither of those formats are supported, the img element will be chosen. Parse a comma-separated list of component values. The picture element is a container which provides multiples sources to its contained img element to allow authors to declaratively control or give hints to the user agent about which image resource to use, based on the screen pixel density, viewport size, image format, and other factors.
It represents its children. The picture element is somewhat different from the similar-looking video and audio elements. As well, the picture element itself does not display anything; it merely provides a context for lframe contained img element that enables it to choose from multiple URLs. The source element allows authors to specify multiple alternative source sets for img elements or multiple alternative media resources for media elements.
It does not represent anything on its own. The type attribute may be present. If present, the value must be a valid MIME type.
Baalise remainder of the requirements depend on whether the parent is a picture element or a media element:. If the srcset attribute has any image candidate strings using a width descriptorthe sizes content attribute must also be present, and the value must be a valid source size list.
The media content attribute may also be present. If present, the value must contain a valid media query list. The type gives the type of the images in the source setto allow the user agent to skip to the next source element if it does not support the given type. If the type attribute is not specified, the user agent will not select a different source element if it finds that it does not support the image format after fetching it.
When a source element has a following sibling source element or img element with a srcset attribute specified, it must have at least one of the following:. A media attribute specified with a value that, after stripping leading and trailing white spaceis not the empty string and is not an ASCII case-insensitive match for the string ” all “. A type attribute specified. Dynamically modifying a source element and its attribute when the element is already inserted in a video balize audio element will have no effect.
To change what is playing, just use the src attribute on the media element directly, possibly making use of the canPlayType method to pick from amongst available resources.
Generally, manipulating source elements manually after the document has been parsed is an unnecessarily complicated approach. The type content attribute gives the type of the media resourceto help the user agent determine if it can play this media resource before fetching it. If specified, its value must be a valid MIME type. The codecs parameter, which certain MIME types define, might be necessary to specify exactly how the resource is encoded. The srcsetsizesand media attributes must not be present.
The IDL attributes srctypesrcsetsizes and media must reflect the respective content attributes of the same name. An img element represents an image and its fallback content. Requirements for alternative representations of the image are described in the next section.
The src attribute must iframs present, and must contain a valid non-empty URL potentially surrounded by spaces referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted.
The srcset attribute may also be present. If an image candidate string contains no descriptors and no space characters after the URL, the following image candidate stringif there is one, must begin with one or more space characters. An image candidate string consists of the balize components, in order, with the further restrictions described below this list:. For the purpose of balose requirement, an image candidate string with no descriptors is equivalent to an image candidate string with a 1x descriptor.
If a source element has a sizes attribute present or an img element has a sizes attribute present, all image candidate strings for that element must have the width descriptor specified. If an image candidate string for a source or img element has the width descriptor specified, all other image candidate strings for that element must also have the width descriptor specified.
The requirements above imply that images can be static bitmaps e. If the srcset attribute is present, the sizes attribute may also be present. If present, its value must be a valid source size list. A valid source size list is a string that matches the following grammar: The vw unit can be used for sizes relative to balie viewport width.
The img element must not be used as a layout tool. In particular, img elements should not be used to display transparent images, as such images rarely convey meaning and rarely add anything useful to the document.
The crossorigin attribute is a CORS settings attribute. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with canvas. The referrerpolicy attribute is a referrer policy attribute. Its purpose is to set the referrer policy used when fetching the image. An img element has a current request and a pending request.
HTML Embedded content
The current request is initially set to a new image request. The pending request is initially set to null. The current request is usually referred to as the img element itself. An balisee request has a statecurrent URL and image data. When an image request is either in the partially available state or in the completely available state, it is said to be available. An image request is initially unavailable. In a browsing context where scripting is disableduser agents may obtain images immediately or on demand.
In a browsing context where scripting is enableduser agents must obtain images immediately.
A user agent that obtains images immediately must immediately update the image data of an img element, with the restart animation flag set if so stated, whenever that element is created or has experienced relevant mutations. A user agent that obtains images on demand must update the image data of an img element whenever it needs the image data i.
When an img element has experienced relevant mutationsif the user agent only obtains images on demand, the img element must return to the unavailable state.