A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop below:

Element: clientTop property - Web APIs

Element: clientTop property

Baseline Widely available

The clientTop read-only property of the Element interface returns the width of the top border of an element in pixels.

All that lies between the offsetTop and clientTop is the element's border. This is because the offsetTop indicates the location of the top of the border (not the margin) while the client area starts immediately below the border, including padding. Therefore, the clientTop value is always equal to the border-top-width, rounded to integer. For example, if the computed border-top-width is zero, then clientTop is also zero.

Value

An integer.

Examples

In the following example, the client area has a white background and a 24px black border-top. The clientTop value is the distance from where the margin (yellow) area ends and the padding and content areas (white) begin: that is, 24px.

HTML
<div id="container">
  <div id="contained">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
      veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
      commodo consequat.
    </p>
  </div>
</div>
CSS
#container {
  margin: 3rem;
  background-color: rgb(255 255 204);
  border: 4px dashed black;
}

#contained {
  margin: 1rem;
  border-top: 24px black solid;
  padding: 0px 28px;
  overflow: auto;
  background-color: white;
}
Result Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4