A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/html-css-exercise/css-properties/outline-offset-answer.php below:

Website Navigation


CSS Properties: How to specify an outline 10px outside the border edge

CSS Properties: How to specify an outline 10px outside the border edgeLast update on February 23 2024 13:05:36 (UTC/GMT +8 hours)

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declares the document type and version of HTML -->
<html><!-- Begins the HTML document -->
<head><!-- Contains metadata and links to external resources -->
<title>How to specify an outline 10px outside the border edge</title><!-- Sets the title of the document -->
<style type="text/css"> /* Starts CSS styling */
 div { /* Styles all div elements */
  margin: 20px; /* Sets the margin around the div */
  width: 150px; /* Sets the width of the div */
  padding: 10px; /* Sets the padding inside the div */
  height: 70px; /* Sets the height of the div */
  border: 2px solid #660033; /* Sets a solid border around the div with a dark red color */
  outline: 2px solid #CCCC33; /* Sets a solid outline around the div with a light yellow color */
  outline-offset: 10px; /* Specifies the distance by which the outline should be offset from the border */
} 
</style><!-- Ends CSS styling -->
</head><!-- Ends the head section -->
<body><!-- Begins the body of the document -->
<h2>w3resource Tutorial</h2><!-- Displays a level 2 heading -->
<div>This division has an outline border 10px outside the border edge.</div><!-- Displays a div element with a text content -->
</body><!-- Ends the body section -->
</html><!-- Ends the HTML document -->

Explanation:

Live Demo:

See the Pen outline-offset-answer by w3resource (@w3resource) on CodePen.

See the solution in the browser

Supported browser

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4