CSS border-collapse Property






<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->




CSS border-collapse Property



Previous
Complete CSS Reference
Next



Example


Set the collapsing borders model for two tables:



#table1 {
    border-collapse: separate;
}

#table2 {
   
border-collapse: collapse;
}

Try it Yourself »

More "Try it Yourself" examples below.




Definition and Usage


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
























Default value: separate
Inherited: yes
Animatable: no. Read about animatable
Version: CSS2
JavaScript syntax: object.style.borderCollapse="collapse"
Try it




Browser Support


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




















Property
border-collapse 1.0 5.0 1.0 1.2 4.0







<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->





CSS Syntax



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


Property Values





























Value Description Play it
separate Borders are separated; each cell will display its own borders. This is default. Play it »
collapse Borders are collapsed into a single border when possible (border-spacing and empty-cells properties
have no effect)
Play it »
initial Sets this property to its default value. Read about initial
Play it »
inherit Inherits 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:



#table1 {
    border-collapse: separate;
   
border-spacing: 10px;
}

Try it Yourself »



Example


When using "border-collapse: collapse", the cell that appears first
in the code will "win":



table, td, th {
    border: 3px solid red;
}

#table1 {
    border-collapse:
collapse;
   
border-color: blue;
}

Try it Yourself »



Related Pages


CSS tutorial: CSS Table


HTML DOM reference: borderCollapse property




Previous
Complete CSS Reference
Next

Popular posts from this blog

Chat program with C++ and SFML

Function to Return a JSON Like Objects Using VBA Collections and Arrays

Will my employers contract hold up in court?