Works Unit

Max (width)

<div class="max">

Goes full-width for up to full-width images (or anything else).

On everything except mobiles, which with 'Works Unit' always have 20px side paddings by design.

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

White background for illustrative purposes only.

</div>

Installing the theme

The theme

The 'Works Unit' theme has two WordPress templates for Posts and Pages. They are both single-column with a fixed header at the top and a footer at the bottom. There is no 'sidebar'.

The header contains a few key navigation links. The default is the left hand link to the home page, a link to an archive page and a link to WordPress admin when logged in to WordPress. One or two extra navigation links can be added but it must be done manually by editing the header file header.php. Care must be taken not to extend the header links too far because as the screen is narrowed from full desktop towards tablet and mobile it must not fall onto two lines. It is best to add only one to the archive link, or two more at most depending on the length of the text.

The footer can contain any number of links but again it is best to limit the number to four or five at most.

Inasmuch as many websites contain a menu, the archive page serves this purpose by letting links to other Posts and Pages to be written in WordPress admin. The archive page can be renamed 'menu' but this requires a manual edit of header.php.

The main content column between the header and footer can be 700 pixels wide by selecting the default template or 1024 pixels wide by selecting the wider post or wider page template.

The default width of 700 pixels gives a readable column of text and accommodates an image file with a native width up to 700 pixels. 640 pixel wide images can be accommodated with a white border 30 pixels wide on each side (plus top and bottom). The wider width template accommodates an image file with a native width of 1024 pixels. It is generally recommended that the maximum standard webpage image widths on desktop would be between 1024 pixels and 1920 pixels. Any wider wastes bandwidth. 1920 pixels is a common width for a desktop computer screen but that includes the scrollbar so an image 1920 pixels wide would be slightly squashed so is a bit too wide. 1024 pixels is a good maximum width.

The theme contains a <div> classname 'max' that stetches the whole width of the screen excluding the scrollbar. This class can be used in either template to spread an image across the entire screen without triggering a horizontal scrollbar in any device at any width. The <div class="max"> can be used to spread anything across the entire screen but it is too wide for readable text.

The theme contains <div class="w700″>, <div class="w640″> and <div class="w600″> to contrain the column width to 700 pixels, 640 pixels or 600 pixels as required within the wider templates or <div class="max">.

Remember to add </div> at the bottom of all <div>s.

Images wider than the screen cause a horizontal scrollbar by default, always to be avoided. The theme however generally constrains images to the width of the element they are in but it depends on how they are specified in the page. <style = "width: 100%; max-width: 100%;"> often does the trick (depending on the circumstances).

The standard desktop text size can be reduced slightly with <div class="col">. On mobiles it has no effect. Again, remember to add </div> at the bottom.

Wide image

1024 pixels wide

Gallery


Theme functions

WordPress themes contain a file named functions.php to add features and functionality to the site. The 'Works Unit' functions file does the following:

Additional styles

White box with drop shadow. Inside width 640px or 964px depending on template used.

<div class="bg">

White box with drop shadow.

</div>

600 pixel wide with smaller text on desktop computers and laptops with wider screens. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<div class="w600"><div class="col">

class="w600" narrows the column to 600 pixels, or use class="w640" for 640 pixels or "w700" for 700 pixels.

</div></div>

Style sheet breakpoints

For pages that respond to different screen widths

A 'breakpoint' is a width defined in a style sheet at which the page behaves differently than when it was wider or narrower (as the case may be). This is so the page design 'degrades gracefully' by collapsing or expanding when a user moves from wide to narrower or narrow to wider. Breakpoints cover the whole range of screen widths, from a large desktop screen to a small mobile phone screen, the main issues being readability and no horizontal scrollbars at any width.

The principle of 'cascading style sheets' (CSS) is to put all the main styles in a separate .css document that informs the HTML 'body' of a page how to behave. Style rules can also be put in the invisible HTML 'head' and 'inline' styles can be put in the HTML of the visible page. That's the cascade: style sheet » document head » inline in the HTML.


Basic structure

A <div> is HTML for a block of content. Works Unit has three 'principal' blocks: header, main and footer. The block 'main' has two IDs: #content 700 pixels wide and #wide 1024 pixels wide. The two 'parent' blocks (or <div>) can contain other 'child' blocks but those are constrained by whichever 'parent' block they are in. The child blocks become parents to other child blocks, and so on.


Breakpoints

The Works Unit theme has the following breakpoints:

Over 1101px wide: main#content and main#wide centred at 700px and 1024px respectively, main#full-width 100% width, header 100% width not centred, footer centred with no width specified.

Breakpoint 1 max-width: 1101px: main#wide (1024px) centred with width auto and 30px side margins.

Breakpoint 2 max-width: 777px: main#content (700px) and main#wide (1024px) centered with width auto and 20px side margins. Nothing at less than 777px wide has a fixed with.

Breakpoint 3 max-width: 600px: centres the header.

Breakpoint 4 max-width: 480px: is essentially as guess at mobile portrait and continues to alter text sizes etc.

max-width means anything less than or equal to the specified dimension.

The breakpoints are set to suit the column width + side margins + scrollbar. For a 700 pixel wide column the breakpoint is 700 + 30 + 30 + 17 = 777 pixels. For a screen width below the breakpoint the side margins reduce to 20 pixels and the column and its content shrink with it. Similarly for a 1024 pixel wide column the breakpoint is 1024 + 30 + 30 + 17 = 1101 pixels.

The style sheets also use the same breakpoints as, eg:

Breakpoint 3 min-width: 601px for style rules that apply to any screen width over 600 pixels.

Just over a third of the visits to my websites are on a screen 1920 pixels wide and the rest on a screen width of 1152 pixels or less, right down to mobile phones.

Slide show

Caption (1)

Caption (2)

Caption (3)

The markup

<div class="slideshow-container" style="max-width: 700px;">

<div class="mySlides fade">
<div><img src="img/cms-boat-slide-01.jpg" width="700" height="530" alt=""></div>
<p>Caption (1)</p>
</div>

<div class="mySlides fade">
<div><img src="img/cms-boat-slide-02.jpg" width="700" height="530" alt=""></div>
<p>Caption (2)</p>
</div>

<div class="mySlides fade">
<div><img src="img/cms-boat-slide-03.jpg" width="700" height="530" alt=""></div>
<p>Caption (3)</p>
</div>

<div><a class="prev" onclick="plusSlides(-1)">&#10094;</a></div>
<div><a class="next" onclick="plusSlides(1)">&#10095;</a></div>

</div>

<div class="dotcontainer">
<div class="bullets">
<span class="dot" onclick="currentSlide(1)"></span><span class="dot" onclick="currentSlide(2)"></span><span class="dot" onclick="currentSlide(3)"></span>
</div>
</div>

Modal image

Click picture to enlarge

Caption

Native image width: 1024px

The markup

<div class="relative" style="max-width: 700px;">

<p class="enlarge">Click picture to enlarge</p>

<img src="img/filename.jpg" style="width: 100%; max-width: 700px;" alt="Caption" class="modal-target">

</div>

<p class="caption">Caption</p>

<div id="modal" class="modal">
<div id="modal-close" class="modal-close">&times;</div>
<div><img src="#" alt="" id="modal-content" class="modal-content" style="width: 100%; max-width: 1200px;"></div>
<div id="modal-caption" class="modal-caption" style="width: 80%; max-width: 640px;"></div>
</div>