outline
Overview
UK[ˈaʊtlaɪn] US[ˈaʊtˌlaɪn]
offset
Offset
UK[ˈɒfset] US[ˈɔ:fset]
css outline-offset property syntax
How to use the outline-offset attribute?
Theoutline-offset property sets the distance between the outline and the edge of the border. Basic syntax: outline-offset:length; indicates that the distance between the outline and the border is length. The unit of length can be an absolute unit (such as px) or a relative unit (such as %).
Function: The outline-offset property offsets the outline and draws it on the edge of the border. Outlines differ from borders in two ways: outlines take up no space, and outlines may be non-rectangular.
Syntax: outline-offset: length|inherit;
Description: length Outline and border edge distance. Inherit specifies that the value of the outline-offset attribute should be inherited from the parent element.
Note: All major browsers support the outline-offset attribute, except Internet Explorer.
css outline-offset property example
<!DOCTYPE html> <html> <head> <style> div{ margin:20px; width:150px; padding:10px; height:70px; border:2px solid black; outline:2px solid red; outline-offset:15px;} </style> </head> <body> <p><b>注释:</b>Internet Explorer 和 Opera 不支持 support outline-offset 属性。</p> <div>这个 div 在边框边缘之外 15 像素处有一个轮廓。</div> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance