CSS Syntax and Structure

CSS Syntax and Structure

The style specification is specified differently for each different level. for example

for inline cascading style sheets the style attribute is used to define css

<p style="font-color:#313131; font-size:30px;">This is text</p>  

For the internal and external CSS, style specification,

The selector points to the HTML element you want to style.

The declaration block contains one or more declarations separated by semicolons. for ex., color:orange;

Each declaration includes a CSS property name and a value, separated by a colon.

Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces.

Following most commonly used CSS properties

Property TypeProperty
Fontsfont
font-family
font-size
font-style
font-weight
Texttext-align
text-decoration
text-indent
line-height
line-spacing
Color and Backgroundbackground
background-color
background-image
background-position
backgrond-repeat
color
Bordersborder
border-color
border-width
border-style
border-top
border-top-color
border-top-width
(last three for top, bottom, left, right)
Spacingpadding
padding-bottom
padding-left
padding-right
padding-top
margin
margin-bottom
margin-left
margin-right
margin-top
Sizingheight
max-height
min-height
width
max-width
min-width
Layoutbottom
left
right
top
clear
display
float
overflow
position
visibility
z-index
flex
Listslist-style
list-style-image
list-style-type

Previous: Introduction to CSS

Next: Location of CSS