What are property and value in CSS?
In CSS, property is the characteristic you want to change on an element, and value is the specific setting you assign to that property.
Example:
css
p {
color: red;
}Breakdown:
| Part | What it is |
|---|---|
color | property (defines what exactly we're changing) |
red | value (sets what the color will be) |
Another example:
css
p {
font-size: 18px;
background-color: yellow;
}Here:
| Property | Value |
|---|---|
font-size | 18px |
background-color | yellow |
In short: property is "what we change", value is "what we change it to".
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.