What is a css property

What is a css property
Remacle Jean-Claude
1 minute
2021-06-03
css
property
what is

The css property defines the style of the targeted element and consists of a name and a value.

 h1 { color: red }

For example: by using the "color" property, you can define the text color of the targeted element.

When you want to define more then 1 property, then you need to separate them by a semicolon.

 h1 { color: red; text-size: 20px;}

Where to put it

Inside the style attribute of the element

<h1 style="color:red;">Some text</h1>

In the document head inside a style tag

<head>
<style type="text/css">
h1 { color: red; }
</style>
</head>

In an external css file

You can place all the css rules in an external file that you then can link to.

<link rel="stylesheet" type="text/css" href="/externalcssfile.css">