<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>My Website</title>
<meta name="description" content="Description Goes Here...!">
</head>
<body>
<!-- body goes here-->
</body>
</html>
<a href="..." title="...">My Link</a>
<!-- no -->
<a href = "..." title = "...">My Link</a>
<!-- yes -->
<a href="..." title="...">My Link</a>
default page for a folder (aka "directory")
Your FTP directory strucutre might look like this:
mywebsite.com/public/my_projects/project1/index.html
Your browser url would then look like this:
http://mywebsite.com/my_projects/project1
Apply style to all occurrences of a certain tag
mark {
color:purple;
background-color:cyan;
}
This text should be <mark>highlighted</mark>
And <mark>this too</mark>
Apply the style for only one element.
#once {
color:purple;
background-color:cyan;
}
This will be <mark id="once">special</mark>
But not <mark>this</mark>
Apply the style for multiple occurrences of a certain tag,
--OR-- for more than one type of tags.
.some {
color:purple;
background-color:cyan;
}
This will be <span class="some">special</mark>
<div class="some">This, too!</div>
When several selectors share the same declarations. Separated by commas.
div, span {
color:purple;
background-color:cyan;
}
This will be <span>special</span>
<div>This, too!</div>
When several selectors share the same declarations. Separated by commas.
/* any child - separated by space */
.parent .child {
color:purple;
background-color:cyan;
}
/* direct child - separated by > */
li > a {
text-decoration: none;
}
Apply the same style to all elements.
* {
padding: 5px;
}
960 grid system
Foundation
in HTML / CSS
Boxes inside of other boxes
Example: slack.com footer
display: block;
display: inline;
display: inline-block;
Block elements:
Inline elements:
float: none|left|right|initial|inherit
clear: none|left|right|both|initial|inherit
The clear property specifies on which sides of an element floating elements are not allowed to float:
overflow: visible|hidden|scroll|auto|initial|inherit;
What happens when content overflows bounding box?
box-sizing: content-box /* default */
content-box
width
height
padding
border
margin
box-sizing: border-box
content
width
height
padding
border
margin
/* override via paulirish */
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
A method to override all box-sizing http://www.paulirish.com/2012/box-sizing-border-box-ftw/
px
Pixels
%
Percent (of parent element)
em
Device's default font size is 1.0em.
em = size of the letter "m." Typically 16px or 100%.
rem
The root element's font size is 1.0rem.
Check caniuse.
/* em: */
h1 { font-size: 3em; margin-left: 0.333em }
/* rem: */
h1 { font-size: 3em; margin-left: 1rem }
vw, vh, vmin, vmax
Viewport Units.
1 vw represents 1/100th of the view width.
1 vh represents 1/100th of the view height.
1 vmin/max represents 1/100th of whichever is min/max (if screen is rotated)
Good for mobile.
Check caniuse.
/* Keyword values */ position: static; /* default */ position: relative; position: absolute; position: fixed; position: sticky; /* Global values */ position: inherit; position: initial; position: unset;
height : <length> | <percentage> | inherit
width : <length> | <percentage> | inherit
When position is not static:
top : <length> | <percentage> | auto | inherit
right : <length> | <percentage> | auto | inherit
left : <length> | <percentage> | auto | inherit
bottom : <length> | <percentage> | auto | inherit
"A page element with relative positioning gives you the control to absolutely position children elements inside of it." (read more)
The padding property is a shorthand property for the following individual padding properties:
If the padding property has three values:
If the padding property has two values:
If the padding property has one value:
The margin property is a shorthand property for the following individual margin properties:
auto - center the element within its container.
The border property is a shorthand property for the following individual border properties:
Read More: