property

Transform box — CSS reference

Selects the reference box for percentage transforms and the origin. For this HTML element, content-box excludes padding and border. The 100px content width determines a 100px translation despite a 124px border box. SVG reference boxes have additional rules.

Formal Syntax & Structure

css syntaxcss
transform-box: content-box; transform: translateX(100%);

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>transform-box</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#scene{position:relative;margin:0;width:300px;height:300px}#a{width:100px;height:60px;padding:0;transform-origin:0 0;background:rgb(0,100,0);color:white}#b{width:100px;height:20px;background:rgb(40,80,180)}#a{box-sizing:content-box;padding:10px;border:2px solid black;transform-box:content-box;transform:translateX(100%)}</style><body><main id="scene"><div id="a">A</div><div id="b">B</div></main></body></html>
CSS Reference