w3resource

CSS Properties: How to specify a dotted solid double dashed border?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<html>
<head>
<title>How to specify a dotted solid double dashed border</title><!-- Title of the HTML document -->
<style type="text/css">/* CSS style start*/
div {
border-width: 5px; /* Setting border width to 5 pixels for div elements */
border-style: dotted solid double dashed; /* Setting border style to a combination of "dotted", "solid", "double", and "dashed" for div elements */
Border-color: #CF63EF /* Setting border color to #CF63EF for div elements */
}
</style>
</head>
<body>
<div class="dotted solid double dashed">Dotted solid double dashed border style</div><!-- Div element with multiple border styles -->
</body>
</html>

Explanation:

  • This HTML document demonstrates how to specify a border with a combination of dotted, solid, double, and dashed styles for a div element using CSS.
  • The CSS style block applies styling to all div elements.
  • border-width: 5px; sets the border width to 5 pixels for all div elements.
  • border-style: dotted solid double dashed; sets the border style to a combination of "dotted", "solid", "double", and "dashed" for all div elements, resulting in a border with various segments.
  • border-color: #CF63EF; sets the border color to #CF63EF (a shade of purple) for all div elements.
  • The HTML content contains a div element with the class "dotted solid double dashed", demonstrating the specified combination of border styles.

Live Demo:

See the Pen border-style-dotted-solid-double-dashed-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://www.w3resource.com/html-css-exercise/css-properties/border-style-dotted-solid-double-dashed-answer.php