HTML Code:
<!DOCTYPE html><!-- Declares the document type as HTML -->
<html><!-- Root element of the HTML document -->
<head><!-- Contains metadata about the HTML document -->
<title>How to set the style of the left border</title><!-- Sets the title of the HTML document -->
<style type="text/css"> /* Begins a CSS style block */
h1 {border-style: solid; /* Defines a CSS rule for all h1 elements, setting their border style to solid */
border-width: 3px; /* Sets the width of the border of h1 elements to 3 pixels */
}
h1.none {border-right-style: none;} /* Defines a CSS rule for h1 elements with the class 'none', setting their right border style to none */
h1.dotted {border-right-style: dotted;} /* Defines a CSS rule for h1 elements with the class 'dotted', setting their right border style to dotted */
h1.dashed {border-right-style: dashed;} /* Defines a CSS rule for h1 elements with the class 'dashed', setting their right border style to dashed */
h1.solid {border-right-style: solid;} /* Defines a CSS rule for h1 elements with the class 'solid', setting their right border style to solid */
h1.double {border-right-style: double;} /* Defines a CSS rule for h1 elements with the class 'double', setting their right border style to double */
h1.groove {border-right-style: groove;} /* Defines a CSS rule for h1 elements with the class 'groove', setting their right border style to groove */
h1.ridge {border-right-style: ridge;} /* Defines a CSS rule for h1 elements with the class 'ridge', setting their right border style to ridge */
h1.inset {border-right-style: inset;} /* Defines a CSS rule for h1 elements with the class 'inset', setting their right border style to inset */
h1.outset {border-right-style: outset;} /* Defines a CSS rule for h1 elements with the class 'outset', setting their right border style to outset */
</style><!-- Ends the CSS style block -->
</head><!-- Ends the head section of the HTML document -->
<body><!-- Contains the content of the HTML document -->
<h1 class="none">No right border</h1><!-- Displays the text 'No right border' within an h1 element with the class 'none' -->
<h1 class="dotted">A dotted right border</h1><!-- Displays the text 'A dotted right border' within an h1 element with the class 'dotted' -->
<h1 class="dashed">A dashed right border</h1><!-- Displays the text 'A dashed right border' within an h1 element with the class 'dashed' -->
<h1 class="solid">A solid right border</h1><!-- Displays the text 'A solid right border' within an h1 element with the class 'solid' -->
<h1 class="double">A double right border</h1><!-- Displays the text 'A double right border' within an h1 element with the class 'double' -->
<h1 class="groove">A groove right border</h1><!-- Displays the text 'A groove right border' within an h1 element with the class 'groove' -->
<h1 class="ridge">A ridge right border</h1><!-- Displays the text 'A ridge right border' within an h1 element with the class 'ridge' -->
<h1 class="inset">An inset right border</h1><!-- Displays the text 'An inset right border' within an h1 element with the class 'inset' -->
<h1 class="outset">An outset right border</h1><!-- Displays the text 'An outset right border' within an h1 element with the class 'outset' -->
</body><!-- Ends the body section of the HTML document -->
</html><!-- Ends the HTML document -->
Explanation:
Live Demo:
See the Pen border-right-style-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
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