Skip to content

01 The Pure and Clean Web: HTML and CSS

Tomasz Borek edited this page Oct 17, 2018 · 3 revisions

About

Folks will tell you often, to use pure markup, pure HTML, or pure CSS, so in other words - avoid JavaScript. Since the language is TIMTOWTDI (read: Tim Towdy), broken, dangerous etc.

TIMTOWTDI

Perl’s motto, There Is More Than One Way To Do It, illustrates that you can do even most simple thing in many ways. In fact, some say, too many (that’s why Python goes with something quite opposite).

JS is a powerful language, but you hardly can find common guidelines and Perl’s approach is prevalent here as well. So, for simplicity, we’ll start without it. Leaving the scares aside, there is indeed a lot you can do with just HTML and CSS (or mainly CSS, as Dave Shea’s ZEN Garden presents). And it leaves out a lot of complexity. So, let’s have it. The clean 🍀 and pure 💧 way of true World Wide Web 🌐 - ™. ;-P

CSS Zen Garden

website by Dave Shea and many glorious others, where CSS power is shown. Each version of the website has same markup, but looks WILDLY different: http://www.csszengarden.com/

ℹ️
all exercises are on their own dedicated page

HTML

HTML

HyperText Markup Language. Created by sir Tim Berners-Lee with several inspirations, including lesser known book Garden of Forking Paths. Initially for scientist, to easily follow citations and sources of papers.

HyperText

more than text, text enriched with multimedia content and able to encompass other texts within. Nesting is done through relations.

Relation

link between two things, people, documents, files…​ Concept that was built into web, though never took off as intended. You can find it in CSS (link rel).

We will cover HTML4 and 5, along with several good practices and layouts.

HTML4

Topics to know / understand:

  • What is HTML

  • How is HTML4 different from others

  • How to migrate from HTML4

  • Doc types in HTML4

  • HTML4 "new" tags

  • Tag categories or on element types

  • Working with text

  • Working with forms

  • Working with frames and problems there

Good HTML skeleton

  • HTML template for new page

  • MIME types

  • Good header

  • Meta information about page

  • What will happen if you do it wrong

Good header, good minimal document, order of items there, how to load scripts…​ These questions have been asked before and got a number of answers. Peruse them and learn at your own leisure:

How the browser knows WHAT it is to display? Aka, MIME types.

Browser is given content, and *somehow* it knows what that content is. How it knows if it’s an image, a text or a binary? Read, and find out, but be aware that most of links here deal with FF. Different browser will be - well - different.

ℹ️
Questions

Please, find in the materials above answers to following questions:

  1. What governs a good header?

  2. What are conditional elements?

  3. Why is X-UA element needed in header sometimes?

  4. What are meta tags for?

  5. How can we see the headers of a given page?

  6. What happens if you just create a html file with Hello inside and send it to browser?

  7. What happens if your markup is malformed?

  8. How can you verify markup correctness?

  9. What is a minimum document that will be rendered as HTML?

  10. If I change the extension to something else, what will browser render?

  11. How can I set character encoding?

  12. If I set character encoding, is it enough?

  13. Is character encoding case sensitive or not?

  14. How can I set language?

  15. How can I support internationalization in HTML?

HTML 5

Introducing new tags and capabilities, adding audio, video, graphics, slew of semantic tags and LOTS of form goodies, HTML5 revamps HTML greatly and makes most layouting work much easier and fun.

💡
Excellent (and obligatory) reading material: http://diveintohtml5.info
ℹ️
Questions

Common HTML5 questions are similar (or identical) to previous ones:

  1. Any changes to minimum HTML document? Or a good header? Or doctype?

  2. What new things HTML5 brings?

  3. What is insert HTML5 feature or tag here? How it works? Where would you (not) use it?

  4. I have an HTML4 document, can I migrate? How? Caveats?

  5. HTML5 or native apps, which to choose? Not covered yet, but there’s dedicated page, slowly filled out

  6. What happens if you just create a html file with Hello inside and send it to browser?

  7. What happens if your markup or doctype is malformed?

  8. How can you verify HTML5 markup correctness?

  9. HTML4.01 was like XHTML1. Which XHTML is equivalent to HTML5?

  10. Which browsers support which HTML5 feature?

ℹ️
Advanced features of HTML5 (everything else than semantic tags and form goodies) are best covered after some JS is known, so we’ll cover them later.

CSS

Once we learned to doodle, it’s time to make it ugly, shiny, unbearable, pretty. Ratio is up to you.

CSS

Cascading Style Sheets, ancillary technology for HTML, to style the markup and change it’s appearance, based on rules.

While initially you would use markup for both semantic and presentation, this was messy and hard to reason (why is this tag here, for it’s semantic or due to presentation reasons?) about, so folks decided to split: HTML for structure, CSS for look&feel.

Basics:

  1. Selectors

  2. Rules

  3. Properties (initial, inherited…​)

  4. Specificity

Specificity reading

🔥
Questions:
  1. What is a selector? Property? Value? Can you give examples?

  2. Name three types of selectors?

  3. How is class selector different from id?

  4. Can I use class and ID selector together?

  5. What is selector specificity?

  6. If I have tr, table tr, #myTr and .myTr all selecting some tr markup, with same property being set, what will happen?

  7. What’s the order of applying CSS rules?

  8. What’s the difference between table tr and table > tr, if any?

  9. How many classes may I have?

  10. If I have 100 classes, will specificity rise?

  11. What’s the difference (if any) between #some.other and #some .other?

Cascading:

  1. Container

  2. Inheritance

  3. Default rules

  4. Browser wars strike again

  5. Browser vendors and their prefixes

  6. Resets

🔥
Questions:
  1. What is a container?

  2. Why cascading style sheets?

  3. If I specify style on element, in head tag and via link to .css file, how will my markup look like?

  4. If I don’t specify any rule will my markup look the same everywhere?

  5. What are vendors prefixes?

  6. Why we have vendors prefixes if we have W3c?

  7. If I have animation as standard CSS, do I need to use vendor prefix for it? Elaborate why.

Where to put that thing:

  1. Dimensions

  2. Block or inline (or flow and phrasing)

  3. Float (and clear)

  4. Hiding elements

  5. Measurement units

  6. Box model

  7. Positioning

  8. Depth, or stacking elements

💡
Most important book on CSS you may read. It explains why there are 5 different box models, that display may be overwritten by formatting context, set by siblings, etc.
🔥
Questions:
  1. What is a box model?

  2. Do we have one box model? Why?

  3. Tell me about box-sizing.

Styling your text

  1. Typography - what is it

  2. Origin, or on machine-typing

  3. What’s your medium

  4. Serif or sans

  5. Font families

  6. Font stack