Stile inferiore Proprietà
Esempio
Imposta la posizione inferiore di un elemento <button>:
document.getElementById("myBtn").style.bottom = "100px";
Definizione e utilizzo
La proprietà bottom imposta o restituisce la posizione inferiore di un elemento posizionato.
Questa proprietà specifica la posizione inferiore dell'elemento, inclusi riempimento, barra di scorrimento, bordo e margine.
Suggerimento: un elemento posizionato è un elemento con la proprietà position impostata su: relativa, assoluta o fissa.
Suggerimento: per impostare o restituire la posizione superiore di un elemento posizionato, utilizzare la proprietà top .
Supporto browser
Property | |||||
---|---|---|---|---|---|
bottom | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà in basso:
object.style.bottom
Imposta la proprietà inferiore:
object.style.bottom = "auto|length|%|initial|inherit"
Valori di proprietà
Value | Description |
---|---|
auto | Lets the browser set the bottom position. This is default |
length | Defines the bottom position in length units. Negative values are allowed |
% | Sets the bottom position in % of the height of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Dettagli tecnici
Valore di default: | auto |
---|---|
Valore di ritorno: | Una stringa, che rappresenta la posizione inferiore di un elemento posizionato |
Versione CSS | CSS2 |
Altri esempi
Esempio
Imposta la posizione inferiore di un elemento <div>:
document.getElementById("myDiv").style.bottom = "10px";
Esempio
Utilizzo di valori negativi - Imposta la posizione inferiore di un elemento <div>:
document.getElementById("myDiv").style.bottom = "-100px";
Esempio
Restituisce la posizione inferiore di un elemento <div>:
alert(document.getElementById("myDiv").style.bottom);
Pagine correlate
Tutorial CSS: Posizionamento CSS
Riferimento CSS: proprietà bottom
❮ Oggetto stile