CSS code can be written either as a ruleset in a *.css
file or as an inline style within the *.html
file tags. In both of these cases the core syntax is the same, consisting of a collection of declarations
property:value
The difference is that in case of a ruleset the declarations are placed inside a declaration block attached to a selector
selector {
property:value
}
While in case of inline CSS styling the declaration becomes the value of a html style
attribute inside an opening tag
<element style='value:attribute;'></element>
Examples
p {
color: red;
font-size: 20px;
}
<p style='color:red; font-size: 20px;'> Text </p>