Responsive grid framework in Backlight

The Responsive Grid Framework was introduced in the CE3 version of the TTG Lightroom plug-ins (and has been one of my very favorite features since then). With it you can organize text into columns of different widths. It’s a great way to make your text more interesting to look at. For a more thorough overview, see this post.

There are a few differences in the Backlight version of the Responsive Grid Framework. For starters, you don’t need to add the “clearfix” class to grid_x containers; Matt has already taken care of that.

Related to that, the “container_x” class is gone. It’s been replaced by the “grid_x” class.

Built into Backlight is the “grid_12” class. This will set up a 12 column grid framework. Inside that class, you can set up columns how you like. For example, one column on the left taking up two-thirds of the page (col_8) and one column on the right taking up one-third (col_4).
The html will look like this:


<div class="grid_12">  <!-- this sets up the 12 column grid -->
<div class="col_8">   <!-- this sets up the 2/3 width column -->
--------your html code containing text, pictures, etc--------
</div>
<div class="col_4">   <!-- this sets up the 1/3 width column -->
--------your html code--------------------------------------
</div>
</div>

You can set up any number of columns, as long as they add up to twelve. For instance, three columns of equal width will all get the col_4 class.
Note, when writing code, either write directly in the Backlight or Lightroom Publisher page copy fields or, better yet, write it in a plain text editor like Notepad ++ (Windows) or Text Wrangler (Mac) and then paste where needed in Backlight or Lightroom Publisher albums and album sets.

See a demonstration of the Responsive Grid Framework on my Backlight test site.

Push and Pull Classes

Under normal behavior, when the browser or device width are narrow enough, the columns will reform, one on top of the other. By default the first column in a row will be on top, the second below that, and so on.

But this can be changed by using the “push” and “pull” classes. These classes are contained in a media query that applies them only when the browser’s or device’s width is a minimum of 992px. In other words, the classes will only affect displays 992px or wider. When the browser or device width drops below 992px the columns reform to the order as written in the html.

For example, on desktop displays let’s say that you want to have some text in the left hand column and an image in the right. But on a smart phone you want the image on top and the text below that.

Layout the html how you want it to appear on the mobile device. This means placing the image in the first column and the text in the second column. Add the “push_6” class to the first column and the “pull_6” class to the second column like so:


<div class="grid_12">  
<div class="col_6 push_6">   
<img src="https://yoursite.com/images/picture.jpg" alt="alternate text">
</div>
<div class="col_6 pull_6">   
<h3>Test title</h3>
<p>text you want to appear to the left on desktop and beneath on smart phones</p>
</div>
</div>

See an example of the push and pull classes at work on my Backlight test site.

The Alpha and Omega classes

By default, the column classes have built in left and right padding to give the columns some space between them. This also means that the left column will look “indented” compared to other text on the page and the right column will also look indented. If you want the text of the left and right columns to line up with the rest of the page, you can add the alpha class to the left column and the omega class to the right column.

The Row Class

There is also a new “row” class. I asked Matt about this. This is what he said:

Using .row will force a new row, even when the previous row is unfilled. So this:

<div class=”grid_12″>

<div class=”col_4″></div>

<div class=”col_4″></div>

<div class=”col_4 row”></div>

<div class=”col_4″></div>

</div>

Would give you two rows with two items, and each row occupying 2/3 of the full container width.

And there’s this gem for those who want to define their own grid set up:

There’s styling in place for partial class names, so you can define your own .grid_10, for example, and all you need to provide are widths for each column class, a la .grid_10 .col_10 { width: 10%; }, etc.

If you really want to explore the possibilities, take a look at the css file for the responsive grid. Look in your Backlight download for it:
backlight/modules/okapi-core/static/css/grid-framework-12mf.css

For Backlight 1.2 and later, look here:
backlight/modules/pangolini-core/static/css/grid-framework-12mf.css

For Backlight 2 or 3, go to your site and access the page’s source code. Do this by right-clicking on the page and selecting “View Page Source” or words to that effect, depending on your browser. If you’re one of those who’ve disabled the context menu (right click), then go to the Tools menu in the browse and look for Developer Tools and find View Page Source in that menu.

Once you’re viewing the page source, scroll down to line 45 or so. Look for a line that looks like this:

<link rel="stylesheet" type="text/css" media="all" href="/backlight/publisher/gallery/stylesheet/style/6" />

Click on the link (/backlight/publisher/gallery/stylesheet/style/X). Copy and paste the entire code into a plain text editor and save it as a .css file. You’ll find the Responsive Grid css at around line 515. I keep a copy of the css file on my computer just for reference.

You’ll find other classes to try including the prefix and suffix classes (add space to front or back of a column).

7 thoughts on “Responsive grid framework in Backlight”

  1. Rod – I love the look of this style and worked up a test page for my own Backlight 2 site to play with – https://terrancealexander.com/?page=homepage2019

    The problem I’ve run into is that it works great on my iPad in landscape mode, but when I shift to portrait orientation on my iPad or phone, the menu in the side pallet is all messed up. I’ve tried the menu on either side and have the same result.

    Please take a look at my test page and let me know if you have any thoughts on this? Thanks – love your tips and tricks blog!

    1. looks like you’re missing a closing
      You have seven opening

      tags and only six closing

      tags

      Also, and it’s not causing the problem, but your first line is using deprecated html

      you’re using b and i tags. They are not longer used in html5 and should be changed to strong and em tags respectively.

  2. Thanks Rod – I was actually missing 2 closing tags. You look at it so long and lose the trees inside that forest! Works great now.

    1. It looks like there are many html errors.
      For example, there are several divs with the class “share-on-blog” that are opened but not properly closed. Fix that first and see what happens.

      At the end, there is also a stray <div class=”col_4″> opening, but it’s not closed

      There are anchor elements that do not contain a href attribute. These anchor tags also have <script> tags but no reference to where the script is coming from. Not sure what’s going on there.

      You also have slanted/curly quote marks closing <div class=”col_4″>, they need to be straight. Put the code into a code editor or plain text editor and replace all six of those slanted/curly quotes.

      There’s inline styling with css properties that don’t exist, like “order-bottom” (probably should be border-bottom)

      There’s at least one stray closing p tag

      That’s just a few things. Run the page through the html validator at https://validator.w3.org/ and look at Errors. Especially things like stray tags, unclosed tags.
      For the stray anchor tag errors, try removing preceding spaces.

      After you fix those errors, if there are still problems, can you post to the forum where we’ll get more eyes on it?

    2. Once you clean up the html (especially closing the <div class=”share-on-blog”…> divs, you’ll see that your images aren’t fitting inside the orange border area. To fix that, remove the max-width and max-height attributes in the image tags.

  3. Oh Blimey! Not even close then. You’ll have guessed by now that I know nothing about HTML and was hoping I could meld the HTML that Blurb gave me with yours for the responsive grid. I’ve clearly got some learning to do.
    Thanks anyway for taking the time to look.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About this site

This site is: a repository of time-savers and best practices from a user's perspective, picked up from several years of using TTG plugins.
This site is not: a support site.
Read more here.

Subscribe to new posts

Tip Jar

If this site has saved you some time, kept your hair attached, or otherwise prevented you from tossing the mouse through the monitor, feel free to donate.

Categories


Highly recommended. This is my go-to Lightroom book. Click on the book image. (affiliate link)

Affiliate link!

Current TTG versions

Backlight  4 & 5

See the Backlight Modules page on your site for latest Backlight and module versions and changelogs.

You’ll also find the latest version number and download link for the Lightroom Publisher plugin.
(BL 3 and later)

 

Backlight 1 Versions

Backlight 1.2.4
Pages module 1.2.4
Cart Add-on 4.1.7
Client Response Add-on 7.1.3
Theater Add-on 1.2.6
Galleria Add-on 1.0.0
WordPress Add-on 1.2.6
Publisher 3.2.3

Backlight 1 has seen its end of life. See this post.

CE4 Versions

note: CE4 is no longer being developed or sold. See this post.

TTG-BE: 2.0.5a
Autoindex: 7.0.8
Cart: 3.1.4a
CRG: 6.1.3a
Gallery: 6.1.10
Pages: 7.0.15
Publisher: 2.3.3
Stage: 6.1.6
Theme for WordPress: 3.1.2