A CSS property assign a style or behavior to an HTML element.
Examples include: color, border, margin, font-style, and transform.
A table header with a custom background-color.
First Name | Last Name | Country |
---|---|---|
Denice | Hobermann | Canada |
Paulo | Cornell | Brazil |
Jane | Hollander | USA |
<style>
table.tb { width: 450px; border-collapse: collapse; }
.tb th, .tb td { border: solid 1px #777; padding: 5px; }
.tb thead { background-color: steelblue; color: white; }
</style>
<table class="tb">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<tr>
<td>Denice</td>
<td>Hobermann</td>
<td>Canada</td>
</tr>
<tr>
<td>Paulo</td>
<td>Cornell</td>
<td>Brazil</td>
</tr>
<tr>
<td>Jane</td>
<td>Hollander</td>
<td>USA</td>
</tr>
</tbody>
</table>
CSS supports more than 200 CSS properties. Here's a complete list.
Click a name for details.
Property | Description |
---|---|
align-content | Aligns items in a flex container along flex lines. |
align-items | Aligns evenly spaced items in a flex container. |
align-self | Aligns an item inside a flex container. |
all | Resets all element properties to its default or inherited values. |
animation | Creates an animating element. |
animation-delay | Sets a delay before an animation begins. |
animation-direction | Sets how, in which direction, an animation is played. |
animation-duration | Defines the duration of an animation cycle. |
animation-fill-mode | Defines how styles are applied before and after animation. |
animation-iteration-count | Sets the number of times an animation is played. |
animation-name | Defines a name for the animation. |
animation-play-state | Sets the animation play state to running or paused. |
animation-timing-function | Specifies the animation speed curve. |
backface-visibility | Shows or hides the backface visibility of an element. |
background | Sets the background of an element. |
background-attachment | Defines how the background is attached to an element. |
background-blend-mode | Defines the background layer blending mode. |
background-clip | Defines how background extends beyond the element. |
background-color | Sets the background color of the element. |
background-image | Specifies a background image for an element. |
background-origin | Specifies the background image origin position. |
background-position | Sets the position of a background image. |
background-repeat | Specifies how the background image is repeated. |
background-size | Sets the size of the background image. |
border | Specifies a border for an element |
border-bottom | Specifies a bottom border for an element. |
border-bottom-color | Sets the color of a bottom border . |
border-bottom-left-radius | Sets the border radius of the bottom left corner. |
border-bottom-right-radius | Sets the border radius of the bottom right corner |
border-bottom-style | Sets the style of the bottom border. |
border-bottom-width | Sets the width of the bottom border |
border-collapse | Sets table borders to single collapsed line or separated. |
border-color | Sets the color of the border. |
border-image | Defines an image as border, instead of a color. |
border-image-outset | Sets how far a border image extends beyond the border. |
border-image-repeat | Defines if and how the border image is repeated. |
border-image-slice | Defines how the border image will be sliced. |
border-image-source | Specifies the url of the border image file. |
border-image-width | Sets the width of the image border. |
border-left | Sets the left border of the element. |
border-left-color | Sets the color of the left border. |
border-left-style | Sets the style of the left border. |
border-left-width | Sets the width of the left border. |
border-radius | Sets the radius of the border. |
border-right | Sets the right border of the element. |
border-right-color | Sets the color of the right border. |
border-right-style | Sets the style of the right border. |
border-right-width | Sets the width of the right border. |
border-spacing | Sets the adjacent table cell distance. |
border-style | Defines the style of the border |
border-top | Sets the top border of the element. |
border-top-color | Sets the color of the top border. |
border-top-left-radius | Sets the border radius of the top left corner. |
border-top-right-radius | Sets the border radius of the top right corner. |
border-top-style | Sets the style of the top border. |
border-top-width | Sets the width of the top border. |
border-width | Sets the border width of the element. |
bottom | Positions the element from the bottom of the relative container. |
box-shadow | Adds a shadow effect to an element. |
box-sizing | Sets how element height and width are calculated. |
caption-side | Defines on which side of the table a caption is placed. |
caret-color | Sets the color of the blinking mouse caret. |
@charset | Specifies the character encoding of the stylesheet. |
clear | Sets the element side that does not allow floating elements. |
clip | Sets how an image is cropped or clipped inside a container. |
clip-path | Clips an element inside a specific shape or SVG. |
color | Specifies the color of text in an element. |
column-count | Divides an element into the specified number of columns. |
column-fill | Specifies how divided columns are filled. |
column-gap | Specifies the space between divided columns. |
column-rule | Sets the style, width, and color of a column divider. |
column-rule-color | Sets the color of a column divider. |
column-rule-style | Sets the style of a column divider. |
column-rule-width | Sets the width of a column divider. |
column-span | Sets number of divided columns an element should span. |
column-width | Specifies the width of a divided column. |
columns | Divide an element into columns of a certain width. |
content | Used to insert content before or after an element. |
counter-increment | Increase or decrease a CSS counter. |
counter-reset | Initialize or reset CSS counter. |
cursor | Specifies the shape of the mouse cursor. |
direction | Specifies the text writing direction of a block-level element. |
display | Specify an element's display behavior. |
empty-cells | Specifies whether empty table cell borders will be displayed. |
filter | Adds an image enhancing effect to an image. |
flex | Specifies the width of the flexible items. |
flex-basis | Specifies the initial width of a flex item. |
flex-direction | Specifies the direction for the flex item to align. |
flex-flow | Controls the direction and wrapping of flexible items. |
flex-grow | Specifies how a flex item can grow inside the container. |
flex-shrink | Specifies how a flex item can shrink inside the container. |
flex-wrap | Specifies how flexible items wrap inside the container. |
float | Sets how an element is positioned relative to other elements. |
font | Sets font family, variant, weight, height, and size for an element. |
@font-face | Embeds a custom font inside a web page |
font-family | Sets the font family for an element. |
font-kerning | Sets the spacing between the font's characters. |
font-size | Sets the size of the font for an element. |
font-size-adjust | Specifies a fall-back font size. |
font-stretch | Sets the text characters to a wider or narrower variant. |
font-style | Set the font style to normal, italic, or oblique. |
font-variant | Specifies that text is displayed in a small-caps font. |
font-weight | Sets the weight or thickness of the font. |
grid | Defines a grid layout with responsive rows and columns. |
grid-area | Sets the size and location of grid items in a grid container. |
grid-auto-columns | Specifies the size of the columns in a grid container. |
grid-auto-flow | Specifies the initial placement of items in a grid container. |
grid-auto-rows | Specifies the initial size of the items in a grid container. |
grid-column | Specifies the size and location of a grid item in a grid container. |
grid-column-end | Specifies in which column-line the grid item will end. |
grid-column-gap | Specifies the gap size between columns in a grid container. |
grid-column-start | Specifies in which column line the grid item will start. |
grid-gap | Specifies the gap size between grid rows and columns. |
grid-row | Specifies the grid item size and location in a grid container. |
grid-row-end | Specifies in which row-line the grid item will end. |
grid-row-gap | Specifies the gap size between rows in a grid container. |
grid-row-start | Specifies in which row line the grid item will start |
grid-template | Divides a page into sections with a size, position, and layer. |
grid-template-areas | Specifies area in a grid container. |
grid-template-columns | Sets the number and width of columns in a grid container. |
grid-template-rows | Sets the number and height of rows in a grid container. |
height | Sets the height of an element. |
hyphens | Specifies hyphenation with wrap opportunities in a line of text. |
@import | Imports a style sheet inside another style sheet. |
justify-content | Defines the alignment of items in a flex container. |
@keyframes | Defines the CSS style to animate. |
left | Positions the element from the left of the relative container. |
letter-spacing | Sets the spacing between characters. |
line-height | Sets the vertical spacing between lines of text. |
list-style | Defines the markers (bullet points) for items in a list. |
list-style-image | Defines an image markers (bullet points) for items in a list. |
list-style-position | Sets the marker (bullet point) positions for items in a list |
list-style-type | Defines the marker types (bullet points) for items in a list |
margin | Sets the margin (outside spacing) for an element. |
margin-bottom | Sets the bottom margin (outside spacing) for an element. |
margin-left | Sets the left margin (outside spacing) for an element. |
margin-right | Sets the right margin (outside spacing) for an element. |
margin-top | Sets the top margin (outside spacing) for an element. |
max-height | Sets the maximumn height for an element. |
max-width | Sets the maximum width for an element. |
@media | Applies media queries to a page. |
min-height | Sets the minimum height for an element. |
min-width | Sets the minimum width for an element. |
object-fit | Specifies how an image or video fits inside a container. |
object-position | Specifies the image or video position inside a container. |
opacity | Sets the opacity (transparency) of the element. |
order | Specifies the order of an item in a flex container. |
outline | Adds an outline (highlighted border) to an element. |
outline-color | Sets the color of an outline. |
outline-offset | Sets the space between the outline and border. |
outline-style | Sets the style of an outline. |
outline-width | Sets the width of an outline. |
overflow | Specifies the flow of content that exceeds the container. |
overflow-x | Specifies the flow of content that exceeds the container width. |
overflow-y | Specifies the flow of content that exceeds the container height. |
padding | Sets the spacing between content and element border. |
padding-bottom | Sets the spacing between content and bottom element border. |
padding-left | Sets the spacing between content and left element border. |
padding-right | Sets the spacing between content and right element border. |
padding-top | Sets the spacing between content and top element border. |
page-break-after | Adds a print page-break after an element. |
page-break-before | Adds a print page-break before an element. |
page-break-inside | Specifies if print page-break is allowed inside an element. |
perspective | Adds perspective to a 3D-positioned element. |
perspective-origin | Sets the origin of the perspective for a 3D-positioned element. |
pointer-events | Specifies whether element reacts to pointer events or not. |
position | Sets the element's positioning method. |
quotes | Defines the quotation marks to be used on text. |
right | Positions the element from the right of the relative container. |
scroll-behavior | Specifies the scrolling behavior of an element |
table-layout | Aligns elements according to a table with rows and columns. |
text-align | Sets the alignment of text inside an element. |
text-align-last | Sets the alignment for the last line of text. |
text-decoration | Defines the style and color of underlined text. |
text-decoration-color | Defines the color of underlined text. |
text-decoration-line | Defines the kind of line to use with text. |
text-decoration-style | Defines the style of underlined text. |
text-indent | Sets the indentation to the beginning of text. |
text-justify | Defines the text justification inside a container. |
text-overflow | Sets the display behavior of text that overflows a container. |
text-shadow | Adds a shadow effect to text. |
text-transform | Defines text capitalization or casing. |
top | Positions the element from the top of the relative container |
transform | Applies a 2D or 3D transformation to an element. |
transform-origin | Sets the origin for the transformation of the element. |
transform-style | Specifies the display behavior of 3D space nested elements. |
transition | Creates transitions from one property value to another. |
transition-delay | Creates a delay before the transition effect starts. |
transition-duration | Specifies the time the transition will take. |
transition-property | Specifies the CSS property that will transition. |
transition-timing-function | Defines the speed curve function of the transition. |
user-select | Specifies how text can be selected (highlighted) |
vertical-align | Specifies vertical alignment of an element. |
visibility | Specifies the visibility of an element. |
white-space | Specifies how white-space is handled inside an element. |
width | Sets the width of an element. |
word-break | Specifies how line breaks take place. |
word-spacing | Sets the spacing between words. |
word-wrap | Specifies how long words can be wrapped. |
writing-mode | Sets the text reading orientation: top to bottom, etc. |
z-index | Sets the vertical stacking order relative to other elements. |
Browser vendors regularly experiment with new, non-standard CSS properties. To indicate that these are browser specific they are prefixed, like so:
-webkit-...
-moz-...
-ms-...
-o-...
During the transition period when a property is supported by all browsers - but not fully standardized - you will see CSS like this:
-webkit-transition: background-color 2s ease-out; -moz-transition: background-color 2s ease-out; -ms-transition: background-color 2s ease-out; -o-transition: background-color 2s ease-out; transition: background-color 2s ease-out;
When they become standardized, the prefix becomes obsolete. Depending on the browsers your users use, you may decide to include prefixed properties.
The CSS examples in this tutorial do not include vendor prefixes.