Back to Vlad
Project 0

Ideas of modern web-design

The lecture, built as a living page. Every idea below works on this very page, so you can click it, resize it and look at its code.

Sklyarenko Vlad

Sklyarenko Vlad

01 · Skeleton

DOCTYPE, lang, title

<!DOCTYPE html> is the very first line. It is a DOCTYPE declaration: it tells the browser this is modern HTML5.

lang="en" is an attribute (<tag attribute="value">). It helps search engines and screen readers know the language of the page.

<title> is the text on the browser tab. Look up: this page's tab says Project 0.

02 · Headings

HTML headings h1 – h6

<h1>Heading 1</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<h4>Heading 4</h4>

<h5>Heading 5</h5>
<h6>Heading 6</h6>
03 · DOM

Document Object Model

The browser turns your HTML into a tree. Each tag is a node, and the text inside is a node too.

  • html
    • head
      • title
        • Project 0. Ideas of modern web-design
    • body
      • h1
        • Sklyarenko Vlad
      • img
04 · JavaScript

JavaScript changes the DOM

Press Go. The script reaches the field through the DOM path document.fr.fname.value and replaces the text.

LIVE DEMO

05 · CSS

Cascading Style Sheets, three ways

This page uses all three. Inline: the style="" attribute on the name above. Internal: the <style> block in <head>. External: the file style.css.

Common properties

colorthe color of text
text-alignwhere elements are placed on the page
background-colorcan be set to any color
width / heightin pixels or percent of a page
paddinghow much space is left inside an element
marginhow much space is left outside an element
font-familytype of font for text on the page
font-sizein pixels
bordersize, type (solid, dashed…) and color

Box model playground

Move the sliders and watch the grey box. The blue frame is the border.

20px 20px 6px 140px
Project 0

Total width on the page = width + padding×2 + border×2 + margin×2.

06 · Responsive

Viewport and @media queries

The viewport meta tag makes the page match the real screen width of a phone. An @media query then changes the style depending on that width. Resize your window, or turn your phone sideways.

…

Wide screen: #fae5a6. Narrow screen: white. The breakpoint is 600px.

07 · Flexbox

Flexbox container

One <div id="container"> holds the six project boxes. With display: flex they line up, and flex-wrap decides what happens when the row is full. Try it:

Project 0
Project 1
Project 2
Project 3
Project 4
Project 5

Resize the window: the boxes re-flow by themselves, with no extra code.

08 · Search engines

Who reads your page?

A search engine sends a web spider (crawler) through the web. Good HTML, with lang, a title and real headings, helps it understand your page.

  1. Crawls the web sites
  2. Copies the information in web sites
  3. Stores it in the data base
  4. Displays the results from the data base
Web hosting by Somee.com