CSS property: border-style MCQs Quiz | Class 10
This quiz covers CSS property: border-style for Class X Computer Applications (Code 165), specifically focusing on Unit 2: HTML. Test your knowledge on various border types like solid, dotted, dashed, double, groove, ridge, inset, outset, none, and hidden. Attempt all 10 multiple-choice questions, submit your answers, and download a PDF of your results for review.
Understanding the `border-style` Property in CSS
The CSS border-style property is fundamental for designing the visual appearance of borders around HTML elements. It defines the style of the four borders of an element: top, right, bottom, and left. Understanding the various border styles allows for creative and functional web layouts.
Key `border-style` Values
CSS offers a range of predefined border styles. Here’s a breakdown of the most common ones:
none: This is the default value. It specifies no border. The computed border width is 0, even if aborder-widthis set.hidden: Similar tonone, it also specifies no border. However, for table cells,hiddenborders have a higher priority thannoneborders in border conflict resolution.dotted: Creates a border made of a series of dots. The size and spacing of the dots depend on theborder-width.dashed: Creates a border made of a series of short dash segments. The length and spacing of the dashes depend on theborder-width.solid: Displays a single, straight, unbroken line. This is one of the most commonly used styles.double: Shows two parallel solid lines. Theborder-widthdetermines the combined thickness of the two lines and the space between them.groove: Creates a 3D grooved effect. It appears as if the border is carved into the page. The effect is dependent on theborder-color.ridge: Creates a 3D ridged effect. It appears as if the border is coming out of the page. This is the inverse ofgrooveand is also dependent on theborder-color.inset: Creates a 3D inset effect. It makes the entire box appear as if it’s pushed into the display. This effect is also dependent on theborder-color.outset: Creates a 3D outset effect. It makes the entire box appear as if it’s coming out of the display. This is the inverse ofinsetand is dependent on theborder-color.
Shorthand Property for Borders
The border-style property can be used to set the style for all four sides simultaneously, or for individual sides. It can accept one, two, three, or four values:
border-style: solid;(All four sides are solid)border-style: solid dotted;(Top and bottom are solid, left and right are dotted)border-style: solid dotted dashed;(Top is solid, left and right are dotted, bottom is dashed)border-style: solid dotted dashed groove;(Top is solid, right is dotted, bottom is dashed, left is groove)
For more control, you can use individual properties like border-top-style, border-right-style, border-bottom-style, and border-left-style.
Quick Revision Table of Border Styles
| Style Value | Description |
|---|---|
none |
No border. (Default) |
hidden |
Same as none, but with higher priority in conflict resolution. |
dotted |
A border made of dots. |
dashed |
A border made of dashes. |
solid |
A single, straight line border. |
double |
Two parallel solid lines. |
groove |
A 3D grooved effect. |
ridge |
A 3D ridged effect. |
inset |
A 3D inset effect. |
outset |
A 3D outset effect. |
Practice Questions
-
What is the effect of
border-style: hidden;on an element?Answer: It makes the border invisible, similar to
none, but has a different priority in border conflict resolution, especially in tables. -
If you apply
border-style: double;, how many lines will be visible in the border?Answer: Two parallel solid lines.
-
Which
border-stylevalue is often used to give elements a subtle, simple outline?Answer:
solid. -
How do the
grooveandridgeborder styles differ visually?Answer:
grooveappears carved into the page, whileridgeappears to come out of the page. They are inverses of each other. -
What happens if you set
border-style: dotted solid;?Answer: The top and bottom borders will be dotted, and the left and right borders will be solid.