Chapter 16 Using a CSS Grid System

Layout Grid a systematic arrangement of Rows and Columns

Grid System is a CSS file that adds layout grid to a web page

How Grid Works

smap shoot w `12 grids

note 12 is evenly divided by 2,3,4 or 6 columns

<div class="container">
<div class="row" >
❶ <div class="four columns" >
company logo
4 Columns
header and footer are 4 and 8 unit
<div class="eight columns">
8 Columns and/or Units
For Left Navigation Buttons
</div>
</div> <!-- End div first Row -->
❷, ❸ <div class=row"><div class="twelve columns">
Titles use all 12 units
</div></div>
❹Content is 3 equal widths with equal gutters
4 Units 4 Units 4 Units
❺ 4 Units 8 Units
snap shot w labels

Structuring Your HTML Grids...

Lightweight CSS Grid Systems (page 497)

Heavyweight CSS/JavaScript frameworks, include JavaScript code replacing jQueryUI.

All fluid grid systems above are RWD, A more advance method is display:flex, which is covered in next chapter.
Note these systems expect the same sized content. You may have to add CSS to set heights. As of Spring/2019 none of these system recognize high resolution aka retina displays.

Using the Skeleton Grid System (github last update 2014) - flex RWD frameworks (not popular yet)

Creating and Naming Columns - columnNames0.html

Creating Full Width Sections

div.container is never full wdith of browser window you have two options...

  1. Set background color/image of body tag
  2. Can place div="container" inside another div block
  3. Can use ID inside of the class="row image" set image class properties
    Example columnNames2.html
  4. Use css box-shadow: x_ offset y_offset blur [spread] color
  5. Use css background-sizing: x width y-width [cover | conains ] property

Styling Buttons page 506 - buttons.html

Skeleton Mobile First

Tutorial Page 509 Adding a Grid

  1. Open the file 16/index.html, save outside of data folder in folder 16
  2. Add before </head> - also copy over the three css files to new folder
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/skeleton.css">
    <link rel="stylesheet" href="css/custom.css">
  3. Below comment <!-- top section --> add.
    <div class="container">
    </div>
  4. Create two rows inside <div class="container" >
    <div class="row">
    </div>
    <div class="row">
    </div>
    </div>
  5. In first rwo add 2 units
    <div class="four columns">
    <p class="logo">My Company</p>
    </div>
    <div class="eight columns nav">
    </div>
  6. Open the file 01-nav.html add code to nav
    <div class="eight columns nav">
    <a href="#">Home</a>
    <a href="#">Our Clients</a>
    <a href="#">About Us</a>
    <a href="#">Careers</a>
    </div>
  7. Add class="button" attrbute to each link
    <a class="button" href="#">Home</a>
    <a class="button"href="#">Our Clients</a>
    <a class="button" href="#">About Us</a>
    <a class="button" href="#">Careers</a>
  8. Add class="button-primary" to first tag
    <a class="button button-primary" href="#">Home</a>
  9. Open 02-action.html copy data to second row
    <h1>We do great things</h1>
    <h2>Donec pulvinar ullamcorper metus</h2>
    <a href="#" class="button button-primary">Learn More</a>
  10. Add class="row action" to second row, will format .action later on
    <div class="row action">
  11. Save index.html in new folder and preview

  12. Open 03-info.html Copy content below <!-- info section -->
  13. Make first div class="container"
  14. Make next two children div class="row"
  15. Aadd class="four columns" to each div inside second row (3 columns)
    <div class="row">
    <div class="four columns">
    <p>Mei te possit instructior…</p>
  16. Open 04-footer.html Copy the HTML paste content belwo <!-- footer -->



  17. save index.hmlt and preview the file

Adding Style

  1. Open related file custom.css
  2. after /* Mobile first queries */ add...
    /* applies to ALL widths */
    .container {
    background-color: pink;
    }
  3. Preview index.html all three containers are now pink
  4. Add new div to header at <!-- top section --> add
    <div class="section header">
    before <div class="container">
  5. Before <!-- info section --> add close </div>
  6. Add customer .header image
    copy imgs frolder from data/16 to working folder add css code to custom.css
    .header {
    padding: 50px 0 70px 0;
    background-image: url(../imgs/header.jpg);
    background-size: cover;
    }
  7. Just below .header section add...
    .logo {
    font-weight: 600;
    color: rgb(255, 209, 143);
    }
  8. Add three more styles after .logo style
    .nav {
    text-align: right;
    }
    .button {
    background-color: rgba(255,255,255,.5);
    }
    .button:hover {
    background-color: rgba(255,255,255,.3);
    }
  9. Add three more styles
    .action {
    text-align: center;
    padding-top: 75px;
    }
    .action h1 {
    margin: 0;
    }
    .action h2 {
    margin: 0 0 20px 0;
    }
  10. NIB - make .header .container transparent ,
    .header .container {
    background-color: transparent;
    }
  11. Save and preview index.html

The Mobile Design page 518