HTML and CSS Presentation
HTML and CSS Presentation
Course
HTML & CSS Layout
The basics Fundamentals
HTML
Hyper Tex Markup Language
t
A markup language is a computer language that defines the
structure and presentation of raw text.
These elements are often nested inside one another, with each
containing information about the type and structure of the
information to be displayed in the browser.
List Anchor
elements elements
Style Other
elements elements
H1 - H6 Section heading
Body Image
elements elements
P Defines paragraphs in the document.
List Anchor
elements elements
Allows the user to retrieve the document at the
A specified URL by clicking on the contents of
href=“url” the element.
Style Other
elements elements
Strong emphasis. Generally displays as
STRONG
Bold.
Body Image
elements elements
EM Emphasis. Generally displays as Italic.
List Anchor
Computer Code. Usually displays in a fixed
elements elements CODE
font.
B Bold
Style Other
elements elements
I Italic
U Underline
Body Image
elements elements
Style Other
elements elements
Form
Input
Textarea
Form
elements
Button
Checkbox
Label
Output
<form oninput=“x.value=parseInt(a.value)">
<input type="range" id="a" value="50">
<output name="x" for="a"></output>
</form>
Semantic HTML - Semantics is the study of the
meanings of words and phrases in a language.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>Hello HTML & CSS course</h1>
</body>
</html>
CSS selector
<!DOCTYPE html> h1 {
<html lang="en"> color: red;
<head> font-size: 30px;
<meta charset="UTF-8"> }
<title>Title</title>
</head>
<body>
<h1>Hello HTML & CSS course</h1>
</body>
</html>
selector {
property: value;
}
width
Common properties height
padding
margin border
border-radius
line-height
background
opacity
visibility
cursor
font
font-size
font-weight
EXCERCISE - 4
classes and id’s
Selectors to memorize
* {
color: blue;
}
.title {
font-size: 12px;
}
#my-title {
font-size: 30px;
}
EXCERCISE
.classA .classB {
color: red;
}
.classA #my-id
{ font-size:
12px;
}
.a .b .c .d{
font-size: 30px;
}
Target by element type
h1 {
color: red;
}
Button:hover
{ background:
blue;
}
input[type=“password”]{
font-size: 30px;
}
EXCERCISE
It will select only the element that is immediately
preceded by the former element.
.classA + .classB {
color: red;
}
direct children
#container > ul {
color: red;
}
.classA ~ .classB
{ font-size:
30px;
}
EXCERCISE
.classA:nth-child(3) {
color: red;
}
.classB:nth-child(4n) {
color: red;
}
ul:nth-of-type(2)
{ font-size:
30px;
}
#my-id:first-child {
color: red;
}
#my-id:last-child {
color: red;
}
#my-id:only-child
{ font-size:
30px;
}
EXCERCISE
Common web tools
https://www.cssmatic.com/box-shadow
http://www.colorzilla.com/gradient-editor/
https://www.cssmatic.com/border-radius
EXCERCISE
Length units
Padding
Content
The box-sizing property
margin margin
border border
padding padding
width width
Centering content
EXCERCISE
the display property
Top: 200px
Left: 100px
A fixed element is positioned relative to the
viewport, which means it always stays in the
same place even if the page is scrolled.
Absolute is the trickiest position value.
absolute behaves like fixed except relative to
the nearest positioned ancestor
relative
EXCERCISE
Stacking
not cleared
float: left float: right
cleared
the great collapse
col-12
EXCERCISE
Flex box
.container {
display: flex;
}
flex-start
flex-end
center
space-between
space-around
space-evenly
align-items
flex-end
flex-start
center
stretch
baseline
flex-start flex-end
align-content
center stretch
space-between space-around
Properties for the children
order
1 2 5
flex-basis: <length>
200px
flex-grow
1 2 1
*flex-shrink
flex
flex-start
flex-end
http://flexboxfroggy.com/
Browser support
Browser vendors are working to stop using vendor prefixes for experimental features.
.my-class {
-webkit-: chrome, safari, newer versions of opera
-moz-: firefox
-o-: //old, pre-webkit, versions of opera
-ms-: //explorer and edge
}
@supports (display: flex) {
div {
display: flex;
}
}
https://caniuse.com/
responsive design
plan small
grid system
media queries
.title {
font-size: 40px;
}
.example {
transition: background 300ms linear; //ease, ease-in, ease-out
}
.element {
animation: pulse 5s infinite;
}
@keyframes pulse {
0% {
background-
color:
#001F3F;
} 100% {
backgr
ou
nd
-
co
lo
r:
#F
EXCERCISE
SASS
Syntactically Awesome Style Sheets
Nesting
ul li .title {
font-size: 12px;
}
ul li .title:hover {
color: blue;
}
Nesting
ul {
li {
.title {
font-size: 12px;
&:hover {
color: blue;
}
}
}
}
_reset.scss
_button.scss
_dropdown.scss
@import "reset";
@import "button";
@import "dropdown";
Extend/Inheritance
.message {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.success {
@extend .message;
border-color: green;
}
.error {
@extend .message;
border-color: red;
}
.warning {
@extend .message;
border-color: yellow;
}
Variables
$primary-color: #333;
$secondary-color: #e0e0e0;
body {
color: $primary-color;
&:hover {
color: $secondary-color;
}
}
Operators
.button {
float: left;
width: 600px / 960px;
}
.dropdown {
float: right;
width: 300px / 960px * 100%;
}
Mixins
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
.box {
@include border-
radius(10px);
}
Functions
@function remy($pxsize)
{ @return
($pxsize/16)+rem;
}
h1 { font-size: remy(32);}
/* h1 { font-size: 2rem; }
*/
Loops
.column-#{$i} { /**/ }
.column-1 {}
/* ... */
.column-12 {}
THANK YOU!