landing page 101
Create a custom landing page using the Genesis Framework
TLDR; Figured out how to do my own landing page. Used the Dambuster widget to wipe the template page clean, then styled everything using a mix of Genesis’s predesigned column classes and custom CSS.
Part 1 below is about Dambuster. Part 2 is about Genesis’s column classes. Parts 3-4 are quick overviews of all the HTML and CSS you need for creating a landing page (special emphasis on div tags). Then I quickly go over responsiveness, how I space elements on a page, how I make fancy-looking hyperlink buttons, and how I make a custom navigation bar.
Okay, so let me preface this guide by saying I’m not a web developer. Coding is like magic to me. I do some stuff, and then either my page implodes or there are unicorns galloping across the screen. Magic.
A lot of Genesis themes have landing page templates already available. Maybe you’re cool using that. I think a lot of people are. But I really hated the predesigned template. I wanted to feel more in control of my pages. And it was my way or the highway. Either I wanted a page that looked exactly how I wanted, or I didn’t even want to bother with it.
I already know basic HTML and CSS magic, but PHP and JavaScript and WordPress and the Genesis Framework are like Chinese to me (okay, more like Uyghur because I’ve studied a little Chinese, but that’s besides the point!). I don’t speak programmer so I don’t even know what to Google most of the time. Basically, I’d tried twice before to make a clean, responsive landing page, and it was just too frustrating. I couldn’t figure anything out.
So yeah. Couldn’t figure it out. Gave up. Then our homeboy Cameron casually mentioned that my blog really needed a landing page. Goddamnit, not again, right?
But I agreed. He was right. So I was determined to get it done. And I did. How? Magic (translation: “I don’t know.”). Took like two weeks of nothing but misery and frustration, but it was worth it.
So without further ado, take a look at my new landing page, as well as my “work with me” page. Like it? Wanna do something similar? Cool, keep reading. I’m going to walk you through all the tools you need to make those. In hindsight, it’s not too hard.
To all the real programmers and web developers reading this, please feel free to call me out on my misinformation, bad form, and general bullshit if you see it! Like I said, I’m not an expert so I’ll happily make any corrections to this guide as well as my coding (aka magic) practices.
Let’s get started
I’m assuming you’re using one of the Genesis themes that are linked in Praxis Month 1 education module, week 1, “Resource: WordPress Themes and Plugins”.
Part 1: Download dambuster
Explained in this section: What is dambuster, where to get it, how to use it
First step, download the Dambuster widget and activate it.
This widget makes it so you can remove everything off of your default template pages. Header, footer, comments, weird spaces, meta data, everything. All you have to do is go to the page you want to edit, scroll to the bottom, check the boxes of the things you don’t want on your page, check “enable tweaks”, and then update the page. Simple.
Note: I don’t ever check the “helper class” box. Feel free to experiment though.
Part 2: Get to know Genesis’s column classes
Explained in this section: Where column classes should be, how to get them if you don’t already have them, what they do, how to use them
Most Genesis child themes include these column classes that make organizing things so, so easy.
Go to your theme’s official CSS space (located below) and search for “column classes”.
If your theme doesn’t have them, you can copy them here and just paste them in your custom CSS (located below).
how to use column classes
Check out this article to see how to use them. Basically, it goes like this:
<div class="two-fourths first">Column one - 2/4</div> <div class="one-fourth second">Column two - 1/4</div> <div class="one-fourth">Column three - 1/4</div>
Don’t need columns? No problem! You don’t have to use them. I use them on my home page and static navigation bars, but I that’s it. I think they’re useful if you want to build your own little navigation bar at the top of the page, or some special sidebars, or if you want a full sized picture of yourself right next to a few paragraphs of text. But if you don’t need them, you don’t need them!
Part 3: What are HTML & CSS
Explained in this section: How to make paragraphs, headers, links, images, and divs on your page
HTML is the words on the page. You use CSS to make HTML look good. If you’re like “God, Leisa, I know that already!”, skip this step. Otherwise, read on!
Here’s the basics of what you need in HTML:
Paragraphs
This is a paragraph.
<p>This is a paragraph.</p>
Headers
This is a header
This is also a header
Still a header
Yay headers
<h1>This is a header</h1> <h2>This is also a header</h2> <h3>Still a header</h3> <h4>Yay headers</h4>
Links
This is Praxis
<a href="http://discoverpraxis.com/">This</a> is Praxis
Images
<img src="http://leisamichelle.com/wp-content/uploads/2016/10/LT-Greek-Logo-Sample.jpeg">
Div
This text is wrapped in a div.
<div>This text is wrapped in a div.</div>
The div tag can be a little confusing at first. With HTML by itself, it doesn’t do anything. But magical things happen when you style div tags (ie, make them pretty) with CSS. We’ll get to that in a minute.
important
Always close your tags (except for img tags)! And make sure they’re nested properly!
GOOD NESTING
<div class="pagetemp1"><p>text</p></div>
BAD NESTING
<div class="pagetemp1"><p>text</div></p>
This is a really rough overview assuming you know nothing about HTML. If you’re hungry for more, you can read about tables and lists and everything else on W3Schools.
Part 4: HTML/CSS lesson on using div tags
Explained in this section: How div tags are used, how classes are styled, “DIVCEPTION”, how to style specific elements (paragraphs, headers, links, etc) that live in your divs
So we get HTML, right? It’s the actual words on the page. The CSS makes the words look pretty. Let’s talk about div tags now in order to understand how CSS works:
Here’s what our original div looks like in HTML:
<div> This text is wrapped in a div. </div>
Now let’s change it to this:
<div class="firstclass">
This text is wrapped in a div.
</div>
We give each div tag a class, and then use CSS to style it. Each div tag can have a maximum of one class.
So let’s jump over to our custom CSS and start making it pretty. Here’s how we style classes in CSS:
.firstclass { color: blue; font-size: 36px; text-align: center; width: 50%; margin: auto; } .nameofclass { attributes: values; ... ... ... }
And it all looks like this when we publish our page:
Not too bad, right? You can change the font color (color), background color (background-color), margins (margin), whether elements appear in a straight line or on new lines (display), everything. Classes are awesome.
Here are the attributes and values I use most often:
color: #000; background-color: #ccc; text-align: left; text-indent: 3em; display: inline-block; padding: 0px; margin: 20px auto;
If most of the things covered so far are new or confusing, don’t click the link I’m about to give you! It will make everything worse. Promise. But if all of this makes complete sense to you or is a review, also check out how you can use ids to compliment your classes. And here’s a useful discussion on Stack Overflow about the difference between classes and ids.
Want to know all the attributes you can use to style your classes? Poke around W3Schools or just Google what you’re looking for.
DIVCEPTION
You can have divs inside divs. Example:
<div class="mynavbar"> <div class="two-sixths first"> <h2>leisa michelle</h2> </div> <div class="one-sixth second"> <a href="">blog</a> </div> <div class="one-sixth third"> <a href="">about me</a> </div> <div class="one-sixth fourth"> <a href="">projects</a> </div> <div class="one-sixth"> <a href="">work with me</a> </div> </div>
The code above is the template I use for my navigation bars when I get rid of the default header. I create a class called “mynavbar” where I define some values (background-color, color, font-family, font-variant, text-align, padding, margin), and I use Genesis’s premade column classes to organize everything.
Styling headers or paragraphs INSIDE your classes
.pagetemp1 { text-align: left; font-size: 18px; margin: auto; } .pagetemp1 p { text-indent: 3em; width: 50%; margin: auto; } .pagetemp1 h2 { text-align: center; background-color: #ccc; color: #fff; padding: 10px 20px; text-decoration: none; }
Anything that you wrap in a div with class “pagetemp1” will have the properties of the overall class (the first listing above). But if you want to style paragraphs or headers or links or tables or, well, anything more specifically within a class, you can use the format above!
All p elements of “pagetemp1” will have the properties of the second listing above, and all h2 elements will have the properties of the third listing above. So the format looks like this:
.classname specificelement { attributes: values; ... ... ... }
important
Again, remember to close your tags and nest them properly in your HTML! And be aware of what you’re naming your classes. Once I had a class called “.page” – and it turns out that that class already exists! It was making my whole site go bonkers. I had to change the name to “.pagetext” to fix everything. So remember that every class name should be unique. Aaand… that’s all there is to it!
Responsiveness
Starting to get tired of typing, taking screenshots, and the like. So I’m going to make this really fast. If it doesn’t make sense, let me know and I’ll rewrite it in a day or two.
So how do you make sure your landing page looks good on desktop, tablet, AND mobile? Here’s how I do it.
.pagetemp1 p { text-indent: 3em; width: 50%; margin: auto; } @media screen and (max-width: 720px) { .pagetemp1 p { width: 100%; padding: 8px; margin: auto; } }
This “@media screen and (max-width: 720px) {}” thing is the most magical form of magic I’ve encountered yet. Every device that has a screen res of higher than 720px will follow the guidelines of the top class. Everything with a lower screen res (so tablets and mobile devices) will follow the rules of the lower class.
What did I tell ya? Exactly. Magic.
FREE CODE
Here’s some stuff I wrote and use. Feel free to use and/or play around with it.
Spacing classes
Disclaimer, this may be bad form. I don’t know. But it works and it’s so easy. I created a series of classes to space elements on a page. I call them “bigspace”, “bigspaceup”, “bigspacedown”, “littlespace”, “littlespaceup”, and “littlespacedown”.
“Bigspace” puts 100px margin above and below whatever uses the class. “Bigspaceup” puts 100px margin above whatever’s using the class. And from there I’m sure you can guess what the rest do.
Feel free to use them as you need:
.bigspace { margin: 100px auto; } .bigspaceup { margin: 100px auto auto; } .bigspacedown { margin: auto auto 100px; } .littlespace { margin: 50px auto; } .littlespaceup { margin: 50px auto auto; } .littlespacedown { margin: auto auto 50px; }
Link buttons
I made these hyperlink buttons too. When you hover over them, the background changes. Two styles. Check it out and use them if you like:
.classname a:link, .classname a:visited { background-color: #fff; color: #ed1c24; border: 1px solid #ed1c24; padding: 10px 20px; text-decoration: none; font-size: 22px; } .classname a:hover, .classname a:active { background-color: #ed1c24; color: #fff; border-color: #fff; font-size: 22px; }
.classname a:link, .classname a:visited { background-color: #ed1c24; color: #fff; border: 1px solid #fff; padding: 10px 20px; text-decoration: none; font-size: 22px; } .classname a:hover, .classname a:active { background-color: #fff; color: #ed1c24; border: 1px solid #ed1c24; font-size: 22px; }
Navigation bar
Here’s my navigation bar. Just take it. Enjoy.
This HTML component should look familiar… 😉
<div class="mynavbar"> <div class="two-sixths first"> <h2>leisa michelle</h2> </div> <div class="one-sixth second"> <a href="">blog</a> </div> <div class="one-sixth third"> <a href="">about me</a> </div> <div class="one-sixth fourth"> <a href="">projects</a> </div> <div class="one-sixth"> <a href="">work with me</a> </div> </div>
CSS Styling
.mynavbar { text-align: center; width: 100%; background-color: #000; padding: 10px 80px 5px 100px; margin: auto; display: inline-block; } .mynavbar h2 { text-align: left; color: #fff; font-family: 'Montserrat', sans-serif; font-variant: small-caps; } .mynavbar a:link, .mynavbar a:visited { color: #fff; font-family: 'Montserrat', sans-serif; font-variant: small-caps; font-size: 20px; } .mynavbar a:hover, .mynavbar a:active { color: #ccc; font-family: 'Montserrat', sans-serif; font-variant: small-caps; font-size: 20px; }