7. ARCHITECTURE OF A WEB PAGE
Skeleton with
HTML
Design with
CSS
Interact with
Javascript
8. LET'S SET A SIMPLE EXAMPLE
HTML
<div class="hello">
hello <span class="highlight">world</span>
</div>
CSS
.hello { font-size: 50px; color: red; }
.highlight { font-weight: bold; }
RESULT
hello world
9. AND A FULL PAGE !
<html>
<head>
<title>The title of my page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header">This is my header</div>
<script src="myscript.js"></script_>
</body>
</html>
11. HTML5 / COMMON TAGS USED
We primarily use : div & span
and a, img, form, input, button.
12. CSS / BIND TO HTML WITH SELECTORS
to identify HTML tags and apply design
.container {}
.container .item:first-child {}
:last-child
:not(:last-child)
13. CSS / COMMON STYLES USED
position, float, display
margin, padding
font‐family, font‐size, font‐weight
text‐align
color, background
14. CSS / ADJUST STYLES WITH CHROME DEVTOOLS
LIVE CODING (slides/htmlcss/css/example.html)
15. SASS / ORGANIZE THE CSS
SASS :
is a CSS preprocessor
simplify reading of the code
structure code in multiple files
20. GRID / UNDERSTAND THE GRID SYSTEM
Bootstrap has a grid of 12 columns.
21. GRID / USE THE GRID SYSTEM
How to use the grid ?
<div class="row">
<div class="col-md-4 col-sm-6">Column 1</div>
<div class="col-md-4 col-sm-6">Column 2</div>
<div class="col-md-4 col-sm-6">Column 3</div>
</div>
The grid will have :
3 columns for a medium screen (width >= 992px)
2 columns for a small screen (768px >= width > 992px)
1 columns for a tiny screen (width < 768px)
DEMO (slides/bootstrap/grid/demo.html)
25. THE SMACSS METHOD EXTENDED
SMACSS (Scalable and Modular Architecture for CSS) is a
style guide for CSS. https://smacss.com
(https://smacss.com)
We split the code into functional modules
26. ORGANIZE FILES / OVERVIEW
mylandingpage
|- bower_components : external plugins
|- node_modules : tools to build the project
|- scss : my common styles
|- src
|- app : the page
|- assets : media files
|- images
|- index.html : the homepage
|- bower.json : list of the external plugins
|- gulpfile.js : JS makefile
|- package.json : list of tools to build the project
27. ORGANIZE FILES / 'SCSS' DIRECTORY
mylandingpage
|- scss
|- _base.scss : basics styles
|- _form.scss : forms
|- _layout.scss : all about structure
|- _mixins.scss : functions
|- _variables.scss : common configuration
|- index.scss : import the previous
|- vendor.scss : import the external styles
28. ORGANIZE FILES / 'SRC/APP' DIRECTORY
mylandingpage
|- src
|- app
|- _header.scss : header of the page
|- _features.scss : feature part
|- _footer.scss : footer of the page
|- _hero.scss : hero part
|- _prices.scss : prices part
|- navbar.js : navbar behavior JS
|- index.js : misc behavior JS
29. ORGANIZE THE HTML CODE
Separate into functional part
<div class="hero">
<div class="hero-header"></div>
<div class="hero-header-title">Use the best, use Jobboard.</div>
<div class="hero-header-subtitle">and stay on top</div>
</div>
<div class="hero-calltoaction">
<button class="btn-register">Register</button>
</div>
</div>
.hero {
padding: 100px 0;
.hero-header { color: gray; }
.hero-header-title { font-size: 40px; }
.hero-header-subtitle { font-size: 20px; }
.hero-calltoaction { margin-top: 50px; }
}
.btn-register { color: white; background: orange; }
34. WHAT IS RESPONSIVE WEB DESIGN
(RWD) ?
Create a site which can be read across a wide range of
devices, from desktop to mobile.
Find screens size here : http://screensiz.es
(http://screensiz.es)
35. WHAT STRATEGY TO USE ?
1. First, develop for desktop !
2. Second, adapt mobile and tablet :)
36. USE @MEDIA QUERIES !
Example :
<div class="hero">…</div>
.hero { width: 960px; }
@media screen and (max-width: 768px) {
.hero { width: 600px; }
}