w3resource

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

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration of HTML5 document type -->
<html>
<head>
<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) */
}
</style>
</head>
<body>
<h1>w3resource Tutorial</h1><!-- Heading with the right border styled as double and green -->
</body>
</html>

Explanation:

  • 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.



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-right-answer.php