CSS Properties: How to set the style of the right border?
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
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
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-right-answer.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics