23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

-ms-grid-columns: 120px 2fr 80px 1fr 80px 2fr 80px 2fr 80px 2fr 80px;<br />

With just these styles we can already see the hub page taking shape in Blend by zooming out in the<br />

artboard:<br />

Now let’s create the individual sections, each one starting as a div that we add in<br />

pages/home/home.html:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

and style them into their appropriate grid cells with 100% width and height. I’m showing hubSection1<br />

here as the others are the same with just a different column number (4, 6, 8, and 10, respectively):<br />

.homepage .hubSection1 {<br />

-ms-grid-row: 1;<br />

-ms-grid-column: 2; /* 4 for hubSection2, 6 for hubSection3, etc. */<br />

width: 100%;<br />

height: 100%;<br />

}<br />

All of this is implemented in the HubPage example included with this chapter.<br />

Laying Out the Sections<br />

Now we can look at the contents of each section. Depending on what you want to display and how you<br />

want those sections to interact, you can again just use layout (<strong>CSS</strong> grids or perhaps flexbox) or use a<br />

control like ListView. hubSection3 and hubSection5 have gaps at the end, so they might be ListView<br />

controls with variable items. Note that if we created lists with more than 9 or 6 items, respectively, we’d<br />

want to adjust the column size in the overall grid and make the section element width larger, but let’s<br />

assume the design calls for a maximum of 9 and 6 items in those sections.<br />

239

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!