Which of the following is the default value for the border-collapse property?

The border-collapse property is for use on <table> elements (or elements made to behave like a table through display: table or display: inline-table).

Syntax

border-collapse: collapse | separate;
  • Initial value: separate
  • Applies to: table and inline-table elements
  • Inherited: yes
  • Computed value: as specified
  • Animation type: discrete

Values

/* Keyword values */
border-collapse: collapse;
border-collapse: separate;

/* Global values */
border-collapse: inherit;
border-collapse: initial;
border-collapse: revert;
border-collapse: revert-layer;
border-collapse: unset;
  • separate (default) – in which all table cells have their own independent borders and there may be space between those cells as well.
  • /* Keyword values */
    border-collapse: collapse;
    border-collapse: separate;
    
    /* Global values */
    border-collapse: inherit;
    border-collapse: initial;
    border-collapse: revert;
    border-collapse: revert-layer;
    border-collapse: unset;
    0 – in which both the space and the borders between table cells collapse so there is only one border and no space between cells.

When border-collapse is

/* Keyword values */
border-collapse: collapse;
border-collapse: separate;

/* Global values */
border-collapse: inherit;
border-collapse: initial;
border-collapse: revert;
border-collapse: revert-layer;
border-collapse: unset;
0, it is notable that properties like
/* Keyword values */
border-collapse: collapse;
border-collapse: separate;

/* Global values */
border-collapse: inherit;
border-collapse: initial;
border-collapse: revert;
border-collapse: revert-layer;
border-collapse: unset;
3 and
/* Keyword values */
border-collapse: collapse;
border-collapse: separate;

/* Global values */
border-collapse: inherit;
border-collapse: initial;
border-collapse: revert;
border-collapse: revert-layer;
border-collapse: unset;
4 (on actual borders) don’t do anything. You’ll need
/* Keyword values */
border-collapse: collapse;
border-collapse: separate;

/* Global values */
border-collapse: inherit;
border-collapse: initial;
border-collapse: revert;
border-collapse: revert-layer;
border-collapse: unset;
5 if you need either of those things.

CSS border-style property sets the style of all four sides of an element’s borders. It is a shorthand property for defining the border-top-style, border-bottom-style, border-left-style, border-right-style.

This property takes from one to four values. So each side can have its own value.

The default value of border-style is none. Borders are put on top of the element’s background.

You also need to know that some browsers do not support some styles. Usually, when a style is not supported, the browser draws the border as a solid one.

The border-style property is defined using one, two, three, or four values. When one value is defined, it applies the same style to all four sides. When two values are defined, the first style applies to the top and bottom sides, the second to the left and right sides. When three values are specified, the first style applies to the top, the second to the left and right, the third to the bottom side. When four values are specified, the styles apply to the top, right, bottom, and left, like a clockwise order.

In this chapter you will learn:

Description

border-collapse property controls if to merge two borders, collapse to one border.

Syntax and Property Values

border-collapse: collapse | separate | inherit

The property values are listed in the following table.

Example




  


Title one Title two
Row Title value value
Row Title value

Click to view the demo

Next chapter...

What you will learn in the next chapter:

The border-collapse property sets whether table borders should collapse into a single border or be separated as in standard HTML.

Show demo ❯

Default value:separateInherited:yesAnimatable:no. Read about animatableVersion:CSS2JavaScript syntax:object.style.borderCollapse="collapse" Try it


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Propertyborder-collapse1.05.01.01.24.0



CSS Syntax

border-collapse: separate|collapse|initial|inherit;

Property Values

ValueDescriptionDemoseparateBorders are separated; each cell will display its own borders. This is default.Demo ❯collapseBorders are collapsed into a single border when possible (border-spacing and empty-cells properties have no effect)Demo ❯initialSets this property to its default value. Read about initialinheritInherits this property from its parent element. Read about inherit


More Examples

Example

When using "border-collapse: separate", the border-spacing property can be used to set the space between the cells:

What is border

The border-collapse CSS property sets whether cells inside a <table> have shared or separate borders.

What value for Border

separate: It is the default value that separates the border of the table cell.

What is the default border value in table structure?

Typically the BORDER attribute (with nonzero value) sets the default value of CELLSPACING to 1. This means that by setting a border for the entire table you also set borders of one pixel for the individual cells.

What is the use of border

The border-spacing CSS property specifies the distance between the borders of adjacent table cells (only for the separated borders model). This is equivalent to the cellspacing attribute in presentational HTML, but an optional second value can be used to set different horizontal and vertical spacing.