The Need For A Vector Box Model

HideMyAss.com

CSS
Laying out fixed pixel ads is a pain. Responsive web design is not fool proof. Such are the ongoing challenges web designers and developers face when building websites. But is there a truly holy grail in building web layouts that adapt and scale appropriately? Yes there is, and its possible through vectors.

First some definitions:

  • Screen - a region of a physical visual device
  • Viewport - a rectangular region that is a portion of a screen

Take a box

  • A box lives within a viewport
  • A box has color, borders, margins and padding
  • It also has dimensions that can be defined in:
    • pixels
    • percent in relation to its viewport
    • percent in relation to the screen
    • related to the size of a scaleable font
  • The box can expand, shrink, keep its size
  • It can expand and shrink proportionally or disproportionally
  • Its contents can do all the above as well (font, image, video, etc.)
  • Boxes can be placed adjacent to each other

    • A box can go outside the top of the other
    • A box can go under the bottom of the other
    • A box can be shadowed by the other
    • A box can envelope the other

Take a layout

  • A layout consists of one or more boxes
  • The layout lives within a device screen
  • Portions of a layout can be shown in a viewport
  • Contents in the viewport (which is a box) can be scaled too

We want layouts that snap to the viewport and scale proportionally.

Take A Vector

  • A vector has a position, direction and extent
  • It lives in its own 2D/3D Gaussian space
  • It can and should be easily defined such as this:
  • .box {
    render-model: vector;
    render-unit: [ems, pixel, percentage];
    vectors: (0,0),(0,99),(99,99),(99,0);
    }

But there is no such thing.

C'mon, we can do better

In the world of technology where new devices are coming online every day no screen size is standard. There are infinite sizes possible and as web developers, we must find a model that works in all cases. If a box is to be proportionate to its surrounding environment it needs to be mathematically described as a vector. It must stretch, it must shrink, and it must scale. This is the only way you will get true responsive design.

So what's stopping this from moving forward?


ASO ad


Filed under: