HTML DOM właściwość align Obraz
Definicja i Wykorzystanie
align zestawy własności lub powraca dostosowanie wartości atrybutów obrazu.
Atrybut align określa wyrównanie zawartości rolkach.
gramatyka
imageObject.align=value
align atrybut może mieć następujące wartości:
值 | 描述 |
---|---|
left | 图像左对齐 |
right | 图像右对齐 |
middle | 图像居中对齐 |
top | 图像顶部对齐 |
bottom | 图像底部对齐 |
Pomoc Browser
Wszystkie główne przeglądarki obsługują atrybut align
Przykłady
Przykłady
Poniższy przykład obrazu w zależności od otaczającego tekstu zostanie wyrównany do prawej:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function alignImg(){
document.getElementById("compman").align="right";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" alt="Computerman" width="107" height="98">
<p>一些文本。一些文本。一些文本。一些文本。一些文本。</p>
<input type="button" onclick="alignImg()" value="图像对齐">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function alignImg(){
document.getElementById("compman").align="right";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" alt="Computerman" width="107" height="98">
<p>一些文本。一些文本。一些文本。一些文本。一些文本。</p>
<input type="button" onclick="alignImg()" value="图像对齐">
</body>
</html>
Spróbuj »
Obiekt Obraz