Most common CSS declarations

31/05/2016

Text formatting

These are properties and values that are used for text-formatting.

Click the tag to go to W3Schools.com for more information.

Property Explanation Example
font

This sets the font of the selector h1 {font: helvetica;}
font-size This sets the size of the text of the selector. You can use px, pt, rem or % as the value h1 {font-size: 32pt;}
color This sets the color of the selector. This property is spesific to text. You can use HEX codes here. h1 {color: #DDEEFF;}

Properties that edits ...

Remember to use semi-colon at the end of the declaration. Unsure? Read this article.

Property Explanation Example
background You can use this property to set color or image as a background of the selector. Click the property for more info. h1 {background: #DDEEFF;} or div {background: url("webnode.com/smiley.png")}

Choose position of element on website

Remember to use semi-colon at the end of the declaration. Unsure? Read this article.

Property Explanation
position This sets the way an element is positioned on the website. The most used are these:
Static - This is the standard value. This makes the element dependednt on the rest of the content.
Relative - Move element based on it's static position.
Fixed - Element will be placed in relation to the browser window. It "sticks" the element to the screen.
Absolute - Choose exactly where you want it, based on its parent element.
- You can use the properties top, right, bottom and left with static, relative and absolute.

You should check out this visual representation of what the different values does.
Check out the presentation here