CSS Properties: How to set the style of the right border?

Go to Exercise page


HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<title>How to set the style of the right border</title><!-- Title of the HTML document -->
<style type="text/css">
/* CSS styling */
h1 {
border-style: solid; /* Sets the border style to solid */
border-right: double #22CF64; /* Sets the style of the right border to double with a color of #22CF64 (green shade) */
<h1>w3resource Tutorial</h1><!-- Heading with the right border styled as double and green -->


  • This HTML document demonstrates how to style the right border of an element using CSS.
  • The <style> block contains CSS rules targeting h1 elements.
  • border-style: solid; sets the border style of the heading to solid, ensuring that it has a visible border.
  • border-right: double #22CF64; applies a double line style to the right border of the heading, with a color of #22CF64, which corresponds to a shade of green.
  • As a result, the right border of the <h1> element is displayed with a double green line style.

Live Demo:

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