fixed
position: fixed;
An element with a fixed position is positioned relative to the browser window, and will not move even if the window is scrolled.
relative
position: relative;
A relative positioned element is positioned relative to its normal position. The content of relatively positioned elements can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow.
absolute
position: absolute;
An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is html. When elements are positioned outside the normal flow, they can overlap other elements.The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others).
color
color: #000;
Modify the textual parts of element by set the color, text-align and text-ident properties.
The color can be assigned to the text of an element in three ways:
- Hex: a value like "ff0000". The order is such that #RRGGBB specify the components of color.
- RGB: a value rgb(255,0,0) will be set red since the first two places (RR) are specified with FF but the rest are set to 0.
- Name: a color name like red. There are 17 standard colors and 123 more making 140 all together.
text-align
text-align: center;
Set the horizontal (left to right) orientation of the text with the text-align property. For example, it may make sense to center the headers on the page. The text can be set according to one of four attributes.
- Center: goes in the middle of the current horizontal space attributed to the element. For example, if a column is assigned to take up 30% of the page, the text-align: center element will go 15% from the left.
- Left: keeps the text on the left side of the surrounding element. This is the default. Only specify left when a surrounding element has center or right and that previous text-align needs to be overwritten with a new text-align of left.
- Align: takes the horizontal space currently allocated to the textual part of the element and outputs the letters with space in between such that every line takes up the same amount of horizontal space as the line preceeding. This has the effect of making both the left and right margins straight.
text-indent
position: absolute;
Set the left offset of the first line of text using the text-indent property. This literary practice is rarely used even in blog posts.
margin
margin: 0 auto;
Background elements can be addressed with the margin, padding and gradient properties.
The margin property assures that there is free space between elements. Margin is transparent and will not cause a background to display. The shorthand property is used to specify all four directions in order. Starting from the top, go in a clockwise direction: Top, right, bottom, left.
There are four main modifiers for the margin property.
- Auto: The browser default calculation.
- Length: The margin in px, ct, or cm. px is the most popular unit of measure.
- %: The percent of the width of the containing element.
- inherit The margin inherited from the parent element.
padding
padding: 10px 20px;
The padding property assures that there is free space around an element. For example, to keep text from bumping up against a horizontal rule preceeding the element, specify the top padding property. Specifying a margin would not be sufficent to keep the rule away from the text since margin starts outside the border of the element. Padding includes the space inside the border.
line-gradient
background: linear-gradient(red, blue);
To create a linear gradient you must define at least two color stops. Color stops are the colors you want to render smooth transitions among. You can also set a starting point and a direction (or an angle) along with the gradient effect.
radical-gradient
background: radial-gradient(red, green, blue);
A radial gradient is defined by its center. To create a radial gradient you must also define at least two color stops. By default, shape is ellipse, size is farthest-corner, and position is center.
─