w3resource

CSS Properties: How to specify a 3D inset border?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<html>
<head>
<title>How to specify a 3D inset border</title><!-- Title of the HTML document -->
<style type="text/css">/* CSS style start*/
h1.inset {
border-width: 10px; /* Setting border width to 10 pixels for elements with class "inset" */
border-style: inset; /* Setting border style to "inset" for elements with class "inset" */
Border-color: #CC63FF /* Setting border color to #CC63FF for elements with class "inset" */
}
</style>
</head>
<body>
<h1 class="inset">Inset border style</h1><!-- Heading with class "inset" -->
<p><strong>Note</strong> This effect depend on the border-color value.</p><!-- Note about the effect of border color on the inset border style -->
</body>
</html>

Explanation:

  • This HTML document demonstrates how to specify a 3D inset border for an element using CSS.
  • The CSS style block defines styling for elements with class "inset".
  • border-width: 10px; sets the border width to 10 pixels for elements with class "inset".
  • border-style: inset; sets the border style to "inset" for elements with class "inset".
  • border-color: #CC63FF; sets the border color to #CC63FF (a shade of purple) for elements with class "inset".
  • The HTML content consists of a <h1> heading with class "inset", demonstrating the specified inset border style.
  • A note is included to indicate that the appearance of the inset border style depends on the border color value.

Live Demo:

See the Pen border-style-inset-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes Yes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/html-css-exercise/css-properties/border-style-inset-answer.php