# Visual Studio Code · Dividir el editor y ampliar un archivo

Al dividir el editor se abre otro grupo donde puedes colocar un segundo archivo. Ajusta el tamaño de los editores para dar más espacio al código largo sin perder de vista el otro archivo.

[Fuente oficial](https://code.visualstudio.com/docs/editing/getting-started/userinterface#_side-by-side-editing)

## Interacción relacionada · Separador ajustable

# Separador ajustable

Un separador móvil cede más espacio a la impresión o a sus notas.

## Cómo probarlo

Mueve el separador, compara el espacio de cada lado y vuelve al reparto por mitades.

## Detalles de la interacción

Limita la vista de impresión al 25–75 % del ancho. Las flechas modifican el reparto en dos puntos porcentuales. Inicio y Fin seleccionan los límites. El botón de reparto equitativo vuelve al 50 %.

## Controles por plataforma

- iOS · Arrastra el asa central a un lado para dar más espacio a la estampa o a las notas.
- Android · Arrastra el asa central a un lado para dar más espacio a la estampa o a las notas.
- PC · Arrastra el asa o enfócala con Tab y usa las flechas izquierda y derecha o las teclas Inicio y Fin.

## Dónde usarlo

Editores con una vista previa junto a un inspector o una ficha.

## Instrucciones de implementación

> Permite ajustar ambos paneles arrastrando el separador o usando el teclado.

## Fuentes y créditos

[W3C WAI · Window Splitter](<https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/>)

## Ejemplo en HTML

Guarda el siguiente código en un archivo HTML y ábrelo en tu navegador. Puedes usar el ejemplo sin conexión.

```html
<!doctype html>
<html lang="es"><head><script>if(new URLSearchParams(location.search).get('reduce')==='1')document.documentElement.classList.add('motion-reduced');</script><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Separador ajustable · Motion Lab</title>
<style>
*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,"Malgun Gothic",sans-serif;word-break:keep-all}button,input{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #ef7c30;outline-offset:2px}button:disabled{cursor:default}button{touch-action:manipulation}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
body{background:#deded3;padding:16px;min-height:100svh;display:grid;place-items:center;color:#252a26}
main{width:min(100%,740px)}header,footer{display:flex;align-items:center;justify-content:space-between;gap:8px}header{margin-bottom:12px}h1{margin:0;font:700 clamp(21px,4vw,32px)/1.2 system-ui;letter-spacing:-.055em}header span,output{font:12px/1.4 monospace}
#panes{display:grid;grid-template-columns:minmax(0,var(--left,1fr)) 24px minmax(0,var(--right,1fr));height:clamp(238px,61svh,335px);background:#f8f5e9;border:1px solid #939489}
#preview,#record{min-width:0;container-type:inline-size}.print{height:100%;position:relative;display:grid;align-content:space-between;padding:clamp(8px,4cqw,20px);overflow:hidden;background:#e1ad4b;color:#292922}
.print small,.print label{position:relative;z-index:1;font:600 11px/1.2 monospace}.glyph{position:absolute;top:12%;bottom:1%;left:14%;display:flex;align-items:center;font:italic 700 clamp(100px,86cqw,263px)/1 Georgia,serif;color:#232920;transform:rotate(-12deg);text-shadow:4px 2px #c34329}.print .stripes{position:absolute;inset:auto 0 0;height:24%;background:repeating-linear-gradient(170deg,transparent 0 5px,#913922 5px 6px)}
#split{cursor:col-resize;position:relative;border:0;border-inline:1px solid #747a71;background:#e4e4d8;touch-action:none;z-index:2;display:grid;place-items:center}#split::before{content:"";position:absolute;top:0;bottom:0;left:50%;width:44px;transform:translateX(-50%)}#split span{width:7px;height:32px;border-inline:2px solid #777b71;pointer-events:none}#split:focus-visible{outline-offset:-3px}
#record{padding:0;background:#f9f7ef;overflow:auto}.record-body{padding:clamp(8px,5cqw,22px);overflow-wrap:anywhere}.record-body h2{margin:0 0 12px;font:italic 700 clamp(20px,14cqw,42px)/1.05 Georgia,serif;letter-spacing:-.055em}.record-body dl{margin:0}.record-body dl>div{display:flex;justify-content:space-between;gap:4px;flex-wrap:wrap;border-top:1px solid #cecdbd;padding:8px 0;color:#353831;font-size:13px}.record-body dt{color:#53594d}.record-body dd{margin:0;font-weight:650}
footer{min-height:55px}footer button{background:#f2f1e7;border:1px solid #8d9081;color:#23271f;padding:7px 11px;border-radius:3px;min-height:44px;font-size:13px}
@media(max-width:400px){body{padding:10px}#panes{grid-template-columns:minmax(0,var(--left,1fr)) 20px minmax(0,var(--right,1fr))}header span{font-size:10px}.record-body dl>div{font-size:12px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.001ms!important;transition-duration:.001ms!important;scroll-behavior:auto!important}}.motion-reduced *,.motion-reduced *::before,.motion-reduced *::after{animation-duration:.001ms!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
</style></head><body>
<main><header><h1>Sala de pruebas tipográficas</h1><span>Muestra / Ficha de composición</span></header>
<div id="panes"><section id="preview" aria-label="Vista previa de la página"><div class="print"><small>TYPE PROOF</small><span class="glyph" aria-hidden="true">Rr</span><i class="stripes" aria-hidden="true"></i><small>R / Romana cursiva</small></div></section>
<div id="split" tabindex="0" role="separator" aria-label="Vista previa de la página" aria-controls="preview" aria-orientation="vertical" aria-valuemin="25" aria-valuemax="75" aria-valuenow="50"><span aria-hidden="true"></span></div>
<section id="record" aria-label="Ficha de composición"><div class="record-body"><h2 lang="en">Type notes</h2><dl><div><dt>Familia tipográfica</dt><dd>Romana cursiva</dd></div><div><dt>Muestra</dt><dd>R / r</dd></div><div><dt>Espaciado entre letras</dt><dd>−24</dd></div><div><dt>Tinta</dt><dd>Negro y bermellón</dd></div><div><dt>Papel</dt><dd>Amarillo sin estucar</dd></div></dl></div></section></div>
<footer><output id="ratio">Página 50 % · Ficha 50 %</output><button id="reset" type="button">Repartir por mitades</button></footer></main>
<script>
const panes=document.querySelector('#panes'),handle=document.querySelector('#split'),readout=document.querySelector('#ratio');
let value=50,drag=null;
function resize(next){
  value=Math.round(Math.max(25,Math.min(75,next)));
  panes.style.setProperty('--left',value+'fr');panes.style.setProperty('--right',(100-value)+'fr');
  handle.setAttribute('aria-valuenow',value);handle.setAttribute('aria-valuetext','Página '+value+' por ciento');
  readout.textContent='Página '+value+'% · Ficha  '+(100-value)+'%';
}
handle.addEventListener('pointerdown',e=>{
  if(!e.isPrimary||e.button!==0)return;
  const available=panes.clientWidth-handle.offsetWidth;
  drag={id:e.pointerId,start:e.clientX,value,available};handle.setPointerCapture(e.pointerId);handle.focus({preventScroll:true});
});
handle.addEventListener('pointermove',e=>{if(drag?.id===e.pointerId)resize(drag.value+(e.clientX-drag.start)*100/drag.available);});
function release(e){if(drag?.id!==e.pointerId)return;drag=null;if(handle.hasPointerCapture(e.pointerId))handle.releasePointerCapture(e.pointerId);}
handle.addEventListener('pointerup',release);handle.addEventListener('pointercancel',release);handle.addEventListener('lostpointercapture',release);
handle.addEventListener('keydown',e=>{
  const target={ArrowLeft:value-2,ArrowRight:value+2,Home:25,End:75};
  if(Object.hasOwn(target,e.key)){e.preventDefault();resize(target[e.key]);}
});
document.querySelector('#reset').onclick=()=>resize(50);resize(50);
</script></body></html>
```
