CSS Properties: How to specify an outline 10px outside the border edge
Solution:
HTML Code:
Explanation:
- This HTML document demonstrates how to specify an outline that is 10px outside the border edge of a div element using CSS.
- CSS comments are added to explain each section of the code.
- The div element is styled with:
- Margin of 20px around the div.
- Width of 150px.
- Padding of 10px inside the div.
- Height of 70px.
- Border of 2px solid with a dark red color (#660033).
- Outline of 2px solid with a light yellow color (#CCCC33).
- Outline offset of 10px, which specifies the distance by which the outline should be offset from the border edge.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | No |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.