Anzeige

Intro to HTML and CSS basics

Front End Development um Market.co.uk
21. Nov 2018
Anzeige

Más contenido relacionado

Anzeige
Anzeige

Intro to HTML and CSS basics

  1. HTML & CSS Course
  2. Development - Training - Consulting 500tech.com
  3. HTML & CSS The basics Layout Fundamentals SASS ANIMATIONS
  4. bit.ly/css-html-course
  5. About mySelf • Experienced FE developer, specialised in B2C applications • FE trainer & lecturer @ 500Tech • Weekends FE developer @ fashbash.co
  6. Tim Berners-lee invents the World wide web 1990
  7. 1994 HTML 2 CSS introduced 1996 world wide web is created
  8. 1998 XHTML is introduced - Microsoft does not adopt it HTML 4 2000 CSS 2
  9. 2006 HTML 5 2009 XHTML is stopped
  10. 2012 CSS 3
  11. HTML
  12. Hyper Text Markup Language
  13. A markup language is a computer language that defines the structure and presentation of raw text. Markup languages work by surrounding raw text with information the computer can interpret, "marking it up" to be processed.
  14. In HTML, the computer can interpret raw text that is wrapped in HTML elements. 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. <element> row text </element>
  15. Hyper Text is text displayed on a computer or device that provides access to other text through links, also known as “hyperlinks.”
  16. <html> <head></head> <body></body> </html>
  17. <html> <head></head> <body></body> </html> Tells the browser that the included text is HTML format
  18. <html> <head></head> <body></body> </html> non-displaying information about the document, like the TITLE and other descriptive tags
  19. <html> <head></head> <body></body> </html> Defines the content of the document.
  20. Body elements Style elements Anchor elements Image elements List elements Other elements
  21. Body elements Style elements Anchor elements Image elements List elements Other elements
  22. Body elements Style elements Anchor elements Image elements List elements Other elements H1 - H6 Section heading P Defines paragraphs in the document. BR Puts a single break in the middle of a paragraph, list item, etc. HR Runs a horizontal line across the page (or table cell) DIV Division - Defines a particular section of the document. Used to spread document attributes across a whole section. SPAN used to group inline-elements in a document
  23. Body elements Style elements Anchor elements Image elements List elements Other elements IMG Displays an 'inline' (embedded in the document) image in the document. Source (SRC="") gives the full or partial URL of the image file to use. ALT gives the alternative/caption text for the image
  24. Body elements Style elements Anchor elements Image elements List elements Other elements UL Unordered list. Bullet List. Items in the list are LI elements. Lists can be nested. OL Ordered list. Numberd (or lettered) list. Items in the list are LI elements. Lists can be nested. LI List item. An item in a bullet or numbered list. DL Definition list. A list of terms with definitions or entries with annotations. DT In an annotated list, the item or term being annotated DD In an annotated list, the annotation or definition
  25. Body elements Style elements Anchor elements Image elements List elements Other elements A href=“url” Allows the user to retrieve the document at the specified URL by clicking on the contents of the element.
  26. Body elements Style elements Anchor elements Image elements List elements Other elements STRONG Strong emphasis. Generally displays as Bold. EM Emphasis. Generally displays as Italic. CITE Citation. Generally displays as Italic. CODE Computer Code. Usually displays in a fixed font. B Bold I Italic U Underline
  27. Body elements Style elements Anchor elements Image elements List elements Other elements <!- - - -> Inserts a 'comment' which does not display on the browser screen, but can be seen in the file itself when viewing the source or editing the HTML.
  28. EXCERCISE - 1-3
  29. Form elements Input Textarea Button Checkbox Label Form
  30. Output <form oninput=“x.value=parseInt(a.value)"> <input type="range" id="a" value="50">
 <output name="x" for="a"></output>
 </form>
  31. EXCERCISE - 4
  32. Semantic HTML - Semantics is the study of the meanings of words and phrases in a language. Semantic elements = elements with a meaning. A semantic element clearly describes its meaning to both the browser and the developer.
  33. <header /> <main /> <footer /> <article /> <details /> <aside /> <div /> <span />
  34. <header /> <main /> <footer /> <article /> <details /> <aside /> <div /> <span />
  35. CSS
  36. Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language.
  37. Inline External
  38. CSS selector <!DOCTYPE html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>Title</title>
 </head>
 <body>
 <h1>Hello HTML & CSS course</h1>
 </body>
 </html>
  39. CSS selector <!DOCTYPE html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>Title</title>
 </head>
 <body>
 <h1>Hello HTML & CSS course</h1>
 </body>
 </html> h1 {
 color: red;
 font-size: 30px;
 }
  40. selector {
 property: value;
 }
  41. Common properties width height padding margin border border-radius line-height background opacity visibility cursor font font-size font-weight
  42. EXCERCISE - 4
  43. classes and id’s
  44. Selectors to memorize
  45. * {
 color: blue;
 } .title {
 font-size: 12px;
 } #my-title {
 font-size: 30px;
 }
  46. EXCERCISE
  47. .classA .classB {
 color: red;
 } .classA #my-id {
 font-size: 12px;
 } .a .b .c .d{
 font-size: 30px;
 }
  48. h1 {
 color: red;
 } Button:hover {
 background: blue;
 } input[type=“password”]{
 font-size: 30px;
 } Target by element type
  49. EXCERCISE
  50. .classA + .classB {
 color: red;
 } .classA ~ .classB {
 font-size: 30px;
 } It will select only the element that is immediately preceded by the former element. #container > ul {
 color: red;
 } direct children It will select all the elements that match after classA
  51. EXCERCISE
  52. .classA:nth-child(3) {
 color: red;
 } ul:nth-of-type(2) {
 font-size: 30px;
 } .classB:nth-child(4n) {
 color: red;
 }
  53. #my-id:first-child {
 color: red;
 } #my-id:only-child {
 font-size: 30px;
 } #my-id:last-child {
 color: red;
 }
  54. EXCERCISE
  55. Common web tools https://www.cssmatic.com/box-shadow http://www.colorzilla.com/gradient-editor/ https://www.cssmatic.com/border-radius
  56. EXCERCISE
  57. Length units CSS has several different units for expressing a length. Many CSS properties take "length" values, such as width, margin, padding, font-size, border-width, etc.
  58. cm Centimeters mm Millimeters in inches px pt 1pt = 1/72 of in pc 1pc = 12pt % Percentage vh 1% of the height of the viewport vw 1% of the width of the viewport rem relative to font size of the root element em Relative to the font size of the element
  59. EXCERCISE
  60. The meta tag Metadata is data (information) about data. The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable.
  61. HTML5 introduced a method to let web designers take control over the viewport, through the <meta> tag. <meta name="viewport" content="width=device-width, initial-scale=1.0">

  62. Layout Fundamentals
  63. Layouting an HTML page is a lot like LEGO, you start with the big blocks and build up your page with smaller blocks of content.
  64. Shay Keinan
  65. LIVE DEMO - INSTAGRAM PAGE
  66. All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout. The CSS box model is essentially a box that wraps around every HTML element.
  67. Margin Border Content Padding
  68. content-box (default) border-box width padding border margin width padding border margin The box-sizing property
  69. Centering content
  70. EXCERCISE
  71. the display property display is CSS's most important property for controlling layout. Every element has a default display value depending on what type of element it is. The default for most elements is usually block or inline.
  72. div is the standard block-level element. A block-level element starts on a new line and stretches out to the left and right as far as it can.
  73. span is the standard inline element. An inline element can wrap some text inside a paragraph <span> like this </span> without disrupting the flow of that paragraph. The a element is the most common inline element, since you use them for links.
  74. Another common display value is none. It is commonly used with JavaScript to hide and show elements without really deleting and recreating them.
  75. Positioning The position property specifies the type of positioning method used for an element (static, relative, fixed, absolute or sticky).
  76. Static - HTML elements are positioned static by default. positioned according to the normal flow of the page.
  77. Relative - behaves the same as static unless you add some extra properties Top: 200px Left: 100px
  78. A fixed element is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled.
  79. Absolute is the trickiest position value. absolute behaves like fixed except relative to the nearest positioned ancestor relative
  80. EXCERCISE
  81. Stacking The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order. Note: z-index only works on positioned elements
  82. EXCERCISE
  83. Float is a CSS positioning property.
  84. Float's sister property is clear. An element that has the clear property set on it will not move up adjacent to the float like the float desires, but will move itself down past the float. float: left float: right not cleared
  85. float: left float: right cleared
  86. the great collapse If this parent element contained nothing but floated elements, the height of it would literally collapse to nothing. float: left float: left float: left
  87. The column layout system http://www.responsivegridsystem.com/calculator/
  88. The column layout system http://www.responsivegridsystem.com/calculator/ col-3 col-3 col-3 col-3
  89. The column layout system http://www.responsivegridsystem.com/calculator/ col-3 col-3 col-3 col-3 col-12
  90. EXCERCISE
  91. Flex box The Flexbox Layout (Flexible Box) module aims at providing a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic (thus the word "flex").
  92. Container item item item
  93. Properties for the parent .container {
 display: flex;
 } This defines a flex container; inline or block depending on the given value. It enables a flex context for all its direct children.
  94. .container {
 flex-direction: row | row-reverse | column | column-reverse;
 }
  95. .container {
 flex-wrap: nowrap | wrap | wrap-reverse;
 }
  96. justify-content flex-start flex-end center space-between space-around space-evenly
  97. align-items flex-start flex-end center stretch baseline
  98. align-content flex-start flex-end center stretch space-between space-around
  99. Properties for the children order 1 2 5
  100. flex-basis: <length> 200px
  101. flex-grow 1 2 1 *flex-shrink
  102. flex This is the shorthand for flex-grow, flex-shrink and flex-basis combined
  103. Align-self flex-start flex-end
  104. http://flexboxfroggy.com/
  105. Browser support Browser vendors are working to stop using vendor prefixes for experimental features.
  106. .my-class {
 -webkit-: chrome, safari, newer versions of opera
 -moz-: firefox -o-: //old, pre-webkit, versions of opera -ms-: //explorer and edge
 }
  107. @supports (display: flex) {
 div {
 display: flex;
 }
 }
 
 @supports not (display: flex) {
 div {
 float: right;
 }
 } https://caniuse.com/
  108. responsive design
  109. plan small avoid fixed dimensions grid system media queries
  110. .title {
 font-size: 40px;
 }
 
 @media only screen and (max-device-width: 360px) {
 /* rules for 0 - 360px dimensions */
 .title {
 font-size: 16px;
 }
 }
  111. Animations
  112. .example {
 transition: [property] [duration] [timing-function] [delay];
 } .example {
 transition: background 300ms linear; //ease, ease-in, ease-out
 }
  113. .element {
 animation: pulse 5s infinite;
 }
 
 @keyframes pulse {
 0% {
 background-color: #001F3F;
 }
 100% {
 background-color: #FF4136;
 }
 }
  114. EXCERCISE
  115. SASS Syntactically Awesome Style Sheets
  116. Nesting ul li .title {
 font-size: 12px;
 }
 
 ul li .title:hover {
 color: blue;
 }

  117. Nesting ul {
 li {
 .title {
 font-size: 12px;
 
 &:hover {
 color: blue;
 }
 }
 }
 } *The Sass Ampersand
  118. Imports /* HTTP request for each import */
 @import "path-to-file";
 @import url("");
  119. Imports @import "reset";
 @import "button";
 @import "dropdown"; Styles _reset.scss _button.scss _dropdown.scss
  120. 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;
 }
  121. Variables $primary-color: #333;
 $secondary-color: #e0e0e0;
 
 body {
 color: $primary-color;
 
 &:hover {
 color: $secondary-color; 
 }
 }
  122. Operators .container { width: 100%; }
 
 .button {
 float: left;
 width: 600px / 960px;
 }
 
 .dropdown {
 float: right;
 width: 300px / 960px * 100%;
 }
  123. 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); 
 }
  124. Functions A function is very similar to a mixin, however the output from a function is a single value. This can be any Sass data type, including: numbers, strings, colors, booleans, or lists.
  125. Functions @function remy($pxsize) {
 @return ($pxsize/16)+rem;
 }
 
 h1 { font-size: remy(32);}
 
 /* h1 { font-size: 2rem; } */
  126. Loops @for $i from 1 through 12 {
 
 .column-#{$i} { /**/ }
 
 }
 
 .column-1 {}
 /* ... */
 .column-12 {}
  127. THANK YOU!
Anzeige