Which of the following property is used to draw a line around elements...
Explanation:The correct answer is option 'C' -
border.
In HTML, the
border property is used to draw a line around elements outside the borders. It allows you to define the style, width, and color of the border. The border can be applied to various HTML elements such as divs, paragraphs, images, tables, etc.
HTML Border Styles:There are several border styles available that can be applied using the
border-style property. Some commonly used border styles are:
1.
Solid: A simple solid line.
2.
Dotted: A series of small dots.
3.
Dashed: A series of short dashes.
4.
Double: Two parallel lines.
5.
Groove: A 3D grooved effect.
6.
Ridge: A 3D ridged effect.
7.
Inset: A 3D inset effect.
8.
Outset: A 3D outset effect.
HTML Border Width:The
border-width property is used to specify the width of the border. It can be set to a specific value in pixels, or you can use keywords like "thin," "medium," or "thick" to define the width.
HTML Border Color:The
border-color property is used to set the color of the border. It can be specified using a color name, RGB values, or hexadecimal color codes.
Example:Let's say we have a div element and we want to apply a border to it. Here's an example of how we can do it:
```html
This is a bordered div element
Hello, world!
```
In this example, we have applied a solid red border with a width of 2 pixels to the div element. The border is also given a border-radius of 5 pixels to make it slightly rounded. The
padding property is used to create some space between the content and the border.
Summary:The
border property in HTML is used to draw a line around elements outside the borders. It allows you to define the style, width, and color of the border. The border can be applied to various HTML elements using the
border-style,
border-width, and
border-color properties.