Applies to all types of file references, including links to CSS files, image sources, and background images.
File Path | What it means |
---|---|
pointB.css | pointB.css is located in the current folder |
css/pointB.css |
pointB.css is located in a folder called css The css folder is located in the current folder |
css/other/pointB.css | pointB.css is located in a folder called other that is located in a folder called css that is located in the current folder |
../pointB.css | pointB.css is located in a folder one level up from the current folder |
../../pointB.css | pointB.css is located in a folder two levels up from the current folder |
<link rel="stylesheet" href="file-path-here.css" />
selector {
display: inline;
}
Examples: <span />, <em />, <strong />,
<a />, <img />
selector {
width: 300px;
}
selector {
height: 100px;
}
Set a width on a block element, then use auto as a margin.
selector {
width: 300px;
margin: auto;
}
selector {
display: block;
}
Examples: <div />, <section />, <p />, <h1 />, <h2 />, <h3 />, <h4 />, <h5 />, <h6 />, and almost everything else
Both padding and margin use the same syntax. Substitute 'margin' for 'padding' to apply margins instead.
One value:
selector {
padding: all;
}
Two values:
selector {
padding: topAndBottom leftAndRight;
}
Four values:
selector {
padding: top right bottom left;
}
Can also specify padding-top, padding-right, padding-bottom, or padding-left to apply padding to individual sides.
selector {
border: thickness style color;
}
Can also specify border-top, border-right, border-bottom, or border-left to apply a border to individual sides.