w3resource

CSS Properties: How to specify border to its default value?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<html>
<head>
<title>How to specify border to its default value</title><!-- Title of the HTML document -->
<style type="text/css">/* CSS style start*/
h1.initial {
border-width: 10px; /* Setting border width to 10 pixels for elements with class "initial" */
border-style: initial; /* Setting border style to its default value for elements with class "initial" */
Border-color: #CC63FF /* Setting border color to #CC63FF for elements with class "initial" */
}
</style>
</head>
<body>
<h1 class="initial">Initial border style</h1><!-- Heading with class "initial" -->
<p><strong>Note</strong>Initial border style is default value</p><!-- Note about the initial border style being the default value -->
</body>
</html>

Explanation:

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

Live Demo:

See the Pen border-style-initial-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.



Follow us on Facebook and Twitter for latest update.