This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

El m猫tode small() crea un element HTML <small> que causa que una cadena es mostri amb una font petita.




El m猫tode small() incrusta una adena en una etiqueta <small>: "<small>str</small>".


Utilitzar small()

L'exemple seg眉ent utilitza m猫todes string per canviar la mida d'una cadena:

var worldString = 'Hola, m贸n';

console.log(worldString.small());     // <small>Hola, m贸n</small>
console.log(worldString.big());       // <big>Hola, m贸n</big>
console.log(worldString.fontsize(7)); // <font size="7">Hola, m贸n</fontsize>

Amb l'objecte (en-US) es pot obtenir l'atribut style  d'un element i manipular-lo m茅s gen猫ricament. Per exemple:

document.getElementById('yourElemId').style.fontSize = '0.7em';


Especificaci贸 Estat Comentaris
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'String.prototype.small' in that specification.
Standard Definici贸 inicial. Implementat en JavaScript 1.0. Definit en l'Annex B (normative) per Caracter铆stiques Addiccionals d'ECMAScript per Navegadors Web.

Compatibilitat amb navegadors

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)
Caracter铆stica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport b脿sic (Yes) 1.0 (1.7 or earlier) (Yes) (Yes) (Yes)
Caracter铆stica Android Chrome per Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport b脿sic (Yes) (Yes) 1.0 (1.0) (Yes) (Yes) (Yes)

Vegeu tamb茅