{"id":254226,"date":"2017-05-06T05:33:13","date_gmt":"2017-05-06T12:33:13","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=254226"},"modified":"2021-08-09T12:05:20","modified_gmt":"2021-08-09T19:05:20","slug":"outline-offset","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/o\/outline-offset\/","title":{"rendered":"outline-offset"},"content":{"rendered":"\n

The outline-offset<\/code> property in CSS offsets a defined outline from an element’s border edge by a specified amount. An outline, which is different from a border, does not take up any space on the page (like an absolutely positioned element) so the outline can be offset in any amount and it will not affect the position or layout of surrounding elements.<\/p>\n\n\n\n\n\n\n\n

.example {\n  outline: solid 2px blue;\n  outline-offset: 10px;\n}<\/code><\/pre>\n\n\n\n

Outlines defined using the outline<\/code> property are often used as focus rings, for accessibility. Thus, the outline-offset<\/code> property allows you to change the position of the focus ring.<\/p>\n\n\n

Values<\/h3>\n\n\n

outline-offset<\/code> accepts one kind of value, a length, which can be:<\/p>\n\n\n\n

  • 0<\/code> (the default)<\/li>
  • Any other valid length with a specified unit (including negative values)<\/li><\/ul>\n\n\n\n

    Note that outline-offset<\/code>, like outline-width<\/code>, does not accept percentage values.<\/p>\n\n\n

    Positioning of the Outline<\/h3>\n\n\n

    By default an element\u2019s outline is drawn immediately outside the border (or immediately outside where the border would be drawn if a border was defined). Therefore, it\u2019s technically possible to combine outline and border for a two-border effect:<\/p>\n\n\n\n