- Layout Construction via HTML

Layout Construction via HTML

Layout Construction

We are going to be using a new tag called <div> to construct a more complex layout, illustrated below:

It is important for us to break this layout down into large chunks before delving into code. From the way I see it, the layout largely consists of the following parts:

Layout components

  • Intro left (image)
  • Intro right (text)
  • Item 1 (image and text)
  • Item 2 (image and text)
  • Item 3 (Image and text)

Notice that I was able to derive a tangible list of elements that we can now translate to code. After setting up your index.html file as described last week, start to build the layout "scaffolding" using the following screenshot as a guide:

<div> elements are simply divisions in the layout --- nothing more, nothing less. Note that we now have four boxes, each of them equipped with its own ID, and all these boxes are conveniently contained in a larger box named "container." Note that I have used identation (tab key) to indicate a level of hierarchy between these elements as well.

Let's continue to address the additional divisions. While "title" and "footer" do not contain any subdivisions, "intro" and "gallery" do. We can further illustrate this using the following:

Note that the two <div>s under "intro" have their own IDs, while the three <div>s under "gallery" share a single class name. This is because I can foresee that the two "intro" subdivisions will be sufficiently different from one another --- while the other group of "gallery" subdivisions will more or less be the same, and can be treated as three identically styled elements.

With the scaffolding completed, we can now proceed with fleshing out these placeholder components with CSS.

Screencast Recording