blob: 13a9a7e4543e4a70ef52ee998defd55741c5f6ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
---
title: HTMLElement.offsetWidth
slug: Web/API/HTMLElement/offsetWidth
translation_of: Web/API/HTMLElement/offsetWidth
---
<div>{{ APIRef("HTML DOM") }}</div>
<p>La propiedad de solo lectura <code><strong>HTMLElement.offsetWidth</strong></code> devuelve el ancho del layout del elemento. Esta medida incluye los bordes del elemento asignados al mismo en los estilos CSS.</p>
<h2 id="Sintáxis">Sintáxis</h2>
<pre class="syntaxbox">var<em> offsetWidth</em> =<em>element</em>.offsetWidth;
</pre>
<p><strong><code>offsetWidth</code> </strong>es una propiedad de solo lectura.</p>
<div class="note">
<p>Esta propiedad redondeará el valor a un entero. Si necesitas un valor fraccional usa: {{ domxref("element.getBoundingClientRect()") }}.</p>
</div>
<h2 id="Ejemplo">Ejemplo</h2>
<p> </p>
<p> <img alt="Image:Dimensions-offset.png" class="internal" src="/@api/deki/files/186/=Dimensions-offset.png"></p>
<h2 id="Especificaciones">Especificaciones</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Especificación</th>
<th scope="col">Estado</th>
<th scope="col">Comentario</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSSOM View', '#dom-htmlelement-offsetwidth', 'offsetWidth')}}</td>
<td>{{Spec2('CSSOM View')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h3 id="Notas">Notas</h3>
<p><code>offsetWidth</code> es una propiedad del <abbr title="Dynamic HyperText Markup Language">DHTML</abbr> "object model" que fue inicialmente introducido por MSIE. A veces es referido como box-width.</p>
<h2 id="Compatibilidad_con_Navegadores">Compatibilidad con Navegadores</h2>
<p>{{Compat("api.HTMLElement.offsetWidth")}}</p>
<h2 id="Links_Relacionados">Links Relacionados</h2>
<ul>
<li>{{domxref("Element.clientWidth")}}</li>
<li>{{domxref("Element.scrollWidth")}}</li>
<li><a href="/en-US/docs/Determining_the_dimensions_of_elements">Determining the dimensions of elements</a></li>
<li><a href="https://docs.microsoft.com/en-us/previous-versions//hh781509(v=vs.85)">MSDN Measuring Element Dimension and Locati</a></li>
</ul>
|