1. Tecnología web para desarrolladores
  2. API web
  3. element
  4. element.clientTop

Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.

View in English Always switch to English

element.clientTop

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since julio de 2015.

Resumen

El ancho del borde superior de un elemento en pixel. No incluye ni el margin-top , ni el padding-top . clientTop es de sólo lectura.

Las aplicaciones "Gecko-based applications" implementan el uso de clientTop a partir de Gecko 1.9 (Firefox 3,ver Error 111207 en Firefox). Esta propiedad no está disponible en Firefox 2 o anteriores.

Sintaxis

js
vartop = element.clientTop;

Ejemplo

<div
 id="offsetContainer"
 style="margin: 26px 0px; background-color: rgb(255, 255, 204); border: 4px dashed black; color: black; position: absolute; left: 260px;">
 <div
 id="idDiv"
 style="margin: 24px 29px; border: 24px black solid; padding: 0px 28px; width: 199px; height: 102px; overflow: auto; background-color: white; font-size: 13px!important; font-family: Arial, sans-serif;">
 <p
 id="PaddingTopLabel"
 style="text-align: center; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif; margin: 0px;">
 padding-top
 </p>
 <p>
 Suave, individualista y muy leal, los gatos de Birmania tienen un carácter
 entre los persas y los siameses. Si le gustan los gatos que no son
 agresivos, disfrutan estar entre los humanos y son generalmente
 tranquilos, esta es la raza para usted.
 </p>
 <p>
 Todos los Birmanos tienen pintas y coloración obscura en la cara, orejas,
 patas y cola.
 </p>
 <p>
 La imagen del gato y el texto vienen de
 <a class="external" href="http://www.best-cat-art.com/"
 >www.best-cat-art.com</a
 >
 </p>
 <p
 id="PaddingBottomLabel"
 style="text-align: center; font-style: italic; font-weight: bold; font-size: 13px!important; font-family: Arial, sans-serif; margin: 0px;">
 padding-bottom
 </p>
 </div>
 <strong
 style="color: blue; font-family: Arial,sans-serif; font-size: 13px!important; font-weight: bold; left: -32px; position: absolute; top: 85px;"
 >Left</strong
 ><strong
 style="color: blue; font-family: Arial,sans-serif; font-size: 13px!important; font-weight: bold; left: 170px; position: absolute; top: -24px;"
 >Top</strong
 ><strong
 style="color: blue; font-family: Arial,sans-serif; font-size: 13px!important; font-weight: bold; left: 370px; position: absolute; top: 85px;"
 >Right</strong
 ><strong
 style="color: blue; font-family: Arial,sans-serif; font-size: 13px!important; font-weight: bold; left: 164px; position: absolute; top: 203px;"
 >Bottom</strong
 >
</div>

Especificaciones

Specification
CSSOM View Module
# dom-element-clienttop

Compatibilidad con navegadores

Referencias

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /