w3resource

CSS Properties: How to set the initial property to the default value of border image width?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<html>
<head>
<title>How to set initial property to its default value</title><!-- Title of the HTML document -->
<style>
/* CSS styling */
#img1 {
  border: 15px solid transparent; /* Sets a transparent solid border with 15px width for the element with id "img1" */
  padding: 15px; /* Adds 15px padding to the element with id "img1" */
  border-image-source: url("https://www.w3resource.com/w3r_images/border.png"); /* Specifies the border image source */
  border-image-repeat: round; /* Sets the border image to be repeated and rounded */
  border-image-slice: 30; /* Sets the size of the border image slices to 30 */
  border-image-width: initial; /* Sets the width of the border image slice to its initial value, which is typically "auto" */
}
</style>
</head>
<body>
<p id="img1">border-image-width: initial;</p><!-- Displays the text "border-image-width: initial;" -->
</body>
</html>

Explanation:

  • This HTML document demonstrates how to set the border-image-width property to its default value using the keyword "initial".
  • The element with id "img1" is styled to have a transparent solid border with 15px width and 15px padding.
  • It also uses a border image sourced from "https://www.w3resource.com/w3r_images/border.png", with the border image slices set to 30 and the border image repeated and rounded.
  • border-image-width: initial; sets the width of the border image slice to its initial value, which is typically "auto".

Live Demo:

See the Pen border-image-width-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 No

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-image-width-initial-answer.php