In this section, we’ll introduce a few widely utilized CSS properties, which we’ll explore in greater detail later on.
The color property in CSS specifies the color of the text.
The font-family‘ property in CSS determines the font style to be applied.
The font-size property in CSS sets the size of the text.
<!DOCTYPE html> <html> <head> <style> h1 { color: blue; font-family: verdana; font-size: 300%; } p { color: red; font-family: courier; font-size: 160%; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> |
The ‘border‘ property in CSS is used to create a border surrounding an HTML element.
Note: Almost every HTML element can have a border defined for it.
p { border: 2px solid powderblue; } |
The padding property in CSS is utilized to create space between the text and its surrounding border.
Utilizing CSS border and padding properties:
p { border: 2px solid powderblue; padding: 30px; } |