Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as [HTML](HTML.md) or [XML](../files/XML.md). CSS is a cornerstone technology of the World Wide Web, alongside [HTML](HTML.md) and JavaScript.
CSS can be used inline via the [HTML](HTML.md) `style` attribute on individual elements or via the `<style>` tag. Traditionally CSS is applied via the `class` and `id` attributes in combination with a linked CSS file.
## Syntax
Example CSS:
```css
body {
color: black;
}
```
### Selector
A CSS selector selects the [HTML](HTML.md) element(s) you want to style.
The `box-shadow` property attaches one or more shadows to an element (Syntax: `box-shadow: none|_h-offset v-offset blur spread color_ |inset|initial|inherit;`).
Margins are used to create space around elements, outside of any defined borders.
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 properties for setting the margin for each side of an element (top, right, bottom, and left).
Padding is used to create space around an element's content, inside of any defined borders.
The CSS `padding` properties are used to generate space around an element's content, inside of any defined borders.
With CSS, you have full control over the padding. There are properties for setting the padding for each side of an element (top, right, bottom, and left).
```css
div {
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
```
### Height and Width
The CSS `height` and `width` properties are used to set the height and width of an element.
The CSS `max-width` property is used to set the maximum width of an element.
The `height` and `width` properties may have the following values:
-`auto` - This is default. The browser calculates the height and width
-`length` - Defines the height/width in px, cm, etc.
-`%` - Defines the height/width in percent of the containing block
-`initial` - Sets the height/width to its default value
-`inherit` - The height/width will be inherited from its parent value
```css
div {
height: 200px;
width: 50%;
background-color: powderblue;
}
```
### Text
CSS has a lot of properties for formatting text.
The `color` property is used to set the color of the text.
```css
h1 { color: green; }
```
The `text-align` property is used to set the horizontal alignment of a text.
A text can be left or right aligned, centered, or justified.
```css
h1 { text-align: center; }
h2 { text-align: left; }
h3 { text-align: right; }
```
The `text-decoration` property is mostly used to remove underlines from links:
```css
a:link { text-decoration: none; }
a:visited { text-decoration: none; }
a:hover { text-decoration: underline; }
```
The `word-spacing` property is used to specify the space between the words in a text.
```css
p.one { word-spacing: 10px; }
```
The `text-shadow` property adds shadow to text.
In its simplest use, you only specify the horizontal shadow (2px) and the vertical shadow (2px):
```css
h1 { text-shadow: 2px 2px; }
body {
text-shadow: <horizontal><vertical><blur><color>;
}
```
### Fonts
In CSS, we use the `font-family` property to specify the font of a text.
```css
.p1 { font-family: "Times New Roman", Times, serif; }