CSS Basics
CSS Basics
CSS Basics
Background
Color
Background
Image
By default, the background-image property repeats an image
both horizontally and vertically.
Some images should be repeated only horizontally or vertically, or
they will look strange, like this:
Background
Image - Repeat
Horizontally or
Vertically
Showing the background image only once is also specified by
the background-repeat property.
Background
Image - Set
position and
no-repeat The position of the image is specified by the background-position
property.
CSS Margins
The CSS margin properties are used to create space around
elements, outside of any defined borders.
With CSS, you have full control over the margins. There are
CSS Margins properties for setting the margin for each side of an element (top,
right, bottom, and left).
CSS has properties for specifying the margin for each side of an
element:
Margin -
All the margin properties can have the following values:
Individual auto - the browser calculates the margin
Sides length - specifies a margin in px, pt, cm, etc.
% - specifies a margin in % of the width of the containing element
inherit - specifies that the margin should be inherited from the
parent element
The following example sets different margins for all four sides of a
<p> element:
To shorten the code, it is possible to specify all the margin properties in one property.
The margin property is a shorthand property for the following individual margin
Margin - properties:
Shorthand
Property