How to Use CSS Grid for Sticky Headers and Footers
CSS Grid is a collection of properties designed to make layout easier than it’s ever been. Like anything, there’s a bit of a learning curve, but Grid is honestly fun to work with once you get the hang of it. One area where it shines is dealing with headers and footers. With a little adjustment in our thinking, we can pull off headers and footers that behave like they are fixed, or have that “sticky” treatment (not position: sticky
, but the kind of footer that hugs the bottom of the screen even if there isn’t enough content to push it there, and is pushed away with more content).
Hopefully this sparks further interest in modern layouts, and if it does, I can’t recommend Rachel Andrew’s book The New CSS Layout strongly enough: it covers both of the major modern layout techniques, grid and flexbox.
What we’re making
Let’s implement a fairly classic HTML layout that consist of a header, main content and footer.
We’ll make a truly fixed footer, one that stays at the bottom of the viewport where the main content scrolls within itself, as needed, then later update the footer to be a more traditional sticky footer that starts at the bottom of the viewport, even if the main content is small, but gets pushed down as needed. Further, to broaden our exposure to grid, let’s design our main content holder so that it can either span the whole width of the viewport, or take up a nicely centered strip down the middle.
A fixed footer is slightly unusual. Footers are commonly designed to start at the bottom of the viewport, and get pushed down by main content as needed. But a persistent footer isn’t unheard of. Charles Schwab does it on their homepage. Either way, it’ll be fun to implement!
But before we move on, feel free to actually peek at the fixed footer implemented on the Charles Schwab site. Unsurprisingly, it uses fixed positioning, which means it has a hard-coded size. In fact, if we crack open DevTools, we see that right off the bat:
body #qq0 {
border-top: 4px solid #133568;
background-color: #eee;
left: 0;
right: 0;
bottom: 0;
height: 40px!important;
}
Not only that, but there’s the balance of making sure the main content doesn’t get hidden behind that fixed footer, which it does by setting hard-coded paddings (including 15px on the bottom of the
Diving Into The Stock Market With Marketstack
The global stock market is something that I think most of us are familiar with, but very few people know how to capitalize on. After all, it’s not as easy as simply sinking money into a stock and hoping it rises.
With the global stock market, there are trends and data that you have to follow in order to really be efficient. That’s where Marketstack comes into play.
What is Marketstack?
Marketstack is a real-time, intraday and historical market data API. It uses a free and easy-to-use REST API interface that delivers worldwide stock market data in JSON format.
By using Marketstack, you can follow trends and get real-time updates on the worldwide stock market. Let’s dive into this a little deeper.
Marketstack features
Marketstack makes it easy for anyone with any skill set to get started. In fact, with 30,000+ happy users, including some big name brands like Uber and Amazon, it’s no wonder Marketstack has the reputation of being so good.
In addition to being so user-friendly, Marketstack comes with a few helpful features. Here’s what you can expect:
Real-time data
With the global market, every minute counts. Obtain real-time stock data for any ticker down to the minute, request intraday quotes or search 30+ years of accurate historical market data.
125,000+ stock tickers
Easily integrate the API and make use of 125,000+ worldwide stock tickers, collected from 72 global exchanges, including Nasdaq, NYSE, and more.
Simple, quick, and reliable
Marketstack is a simple yet powerful API that is both scalable and reliable. With an uptime of nearly 100%, it only takes about 5 minutes to get started.
Lightweight JSON API
Mafrketstack’s stock market data API has been built with simplicity in mind: Requests are made using a simple HTTP GET structure and API response data is delivered in lightweight JSON format.
Bank-level security
All data sent to and from the Marketstack API is encrypted with industry standard 256-bit HTTPS encryption. Rest assured that anything you share through this API is safe and for your eyes only.
Extensive documentation
A straightforward API documentation will help you get up and running within minutes using interactive demo requests and code examples in a variety of programming languages. If you’d like to explore API documentation, click here.
Marketstack pricing
Marketstack offers many subscription plans that cover a wide variety of needs. Best of all, they offer a free subscription to get started, and it comes with its fair share of options:
- Up to 1,000 requests per month
- Connect with 72 stock exchanges around the globe
- Look back at the stock market history for up to 1 whole year
- Gather end-of-data stock data every single day
Of course, if the free plan doesn’t suit your needs, there are still lots of good, paid subscriptions out there for you to take advantage of:
Conclusions
Marketstack is one of the most comprehensive yet powerful tools on the market. It is by far the most powerful tool for keeping track of the worldwide stock market that anyone can get their hands on.
With Marketstack, you can rest assured that the information gathered is 100% accurate and up-to-date. Stock market data provided by the marketstack API is licensed and sourced from multiple high-authority market data providers around the world. Stock market data from United States exchanges is licensed and sourced from Tiingo, Inc. out of New York City, USA.
The Marketstack API service is built on top of apilayer cloud infrastructure and therefore comes with a significant level of scalability and performance. The API currently handles several million API requests per hour with ease.
All-in-all, if you’re looking for a high-volume stock market API, there’s no better choice you can make than signing up for Marketstack.
Read More at Diving Into The Stock Market With Marketstack
Comparing Browsers for Responsive Design
There are a number of these desktop apps where the goal is showing your site at different dimensions all at the same time. So you can, for example, be writing CSS and making sure it’s working across all the viewports in a single glance.
They are all very similar. For example, they do “event mirroring” meaning if you scroll in one window or device, then all the others do too, along with clicks, typing, etc. You can also zoom in and out to see many devices at once, just scaled down. Let’s see if we can root out any differences.
Sizzy
- Windows, Mac, and Linux
- “Solo” plan starts at $5/month and they have plans up from there
There are loads of little cool developer-focused features like:
- Kill a port just by typing in the port number.
- There’s a universal inspect mode but, while you can’t apply a change in DevTools that affects all windows and devices at the same time, you can at least inspect across all of them, and when you click, it activates the correct DevTools session.
- Throttle or go offline in a click.
- Turn off JavaScript with a click.
- Turn on Design Mode with a click (e.g. every element has
contenteditable
). - Toggles for hiding images, turning off all styles, outlining all elements, etc.
- Override fonts with Google Font choices.
Responsively App
- Windows, Mac, and Linx
- Open source (Free)
- Universal inspect mode that selects the correct DevTools context
- The option to “Disable SSL Validation” is clever, should you run into issues with local HTTPS.
- One-click dark mode toggle
Blisk
- Window and Mac
- Free, with premium upgrades ($10/month). Some of the features like scroll syncing and auto refreshing are listed as premium features, which makes me thing that the free version limits them in some way.
- Autorefresh is a neat idea. You set up a “watcher” for certain file types in certain folders, and if they change, it refreshes the page. I imagine most dev environments have some kind of style injection or hot module reloading, but having it available anyway is useful for ones that don’t.
- There is no universal DevTools inspector, but you can open the DevTools individually and they do have a custom universal inspection tool for showing the box model dimensions of elements.
- There’s a custom error report screen.
- You can enable “Browsing Mode” to turn off all the fancy device stuff and just use it as a semi-regular browser.
Polypane
- Windows, Mac, and Linux
- Free, with premium plans starting at $10/month. Signing up is going to get you a good handful onboarding emails over a week (with the option to you can opt out).
- It has browser extensions for other browsers to pop your current tab over to Polypane
- The universal inspect mode seems the most seamless of the bunch to me, but it doesn’t go so far propagate changes across windows and devices. Someone needs to do this! It’s does have a “Live CSS” pane that will inject additional CSS to all the open devices though, which is cool.
- It can open devices based on breakpoints in your own CSS — and it actually works!
Duo
- It’s on the Mac App Store for $5, but its website is offline, which makes it seem kinda dead.
- It has zero fancy features. As the name implies, it simply shows the same site side-by-side in two columns that can be resized.
Re:view
- It’s not a separate browser app, but a browser extension. I kind of like this as I can stay in a canonical browser that I’m already comfortable with that’s getting regular updates.
- The “breakpoints” view is a clever idea. I believe it should show your site at the breakpoints in your CSS, but, it seems broken to me. I’m not sure if this is an actively developed project. (My guess is that it is not.)
So?
What, you want me to pick a winner?
While I was turned off a little Polypane’s hoop jumping and onboarding, I think it has the most well-considered feature set. Sizzy is close, but the interface is more cluttered in a way that doesn’t seem necessary. I admit I like how Blisk is really focused on “just look at the mobile view and then we’ll fill the rest of the space with a larger view” because that’s closer to how I actually work. (I rarely need to see a “device wall” of trivially different mobile screens.)
The fact that Responsively is free and open source is very cool, but is that sustainable? I think I feel safer digging into apps that are run as a business. The fact that I just stay in my normal browser with Re:View means I actually have the highest chance of actually using it, but it feels like a dead project at the moment so I probably won’t. So, for now, I guess I’ll have to crown Polypane.
The post Comparing Browsers for Responsive Design appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
Real-Time Stock Data Using Marketplace’s API
In this time of global economic turmoil, it’s more important than it’s ever been that your financial decisions are based on accurate, up-to-date, market information.
In a world where stock price is a key confidence marker, the businesses that attract attention, secure investment, and grow, are the ones that can demonstrate their value in a wider market.
Up to now, displaying accurate market pricing has been prohibitively expensive, needing direct access to a huge dataset, and the code to mine it. So we’re delighted to introduce marketstack, a real-time market data API that’s reliable, simple to integrate with your site or app, is lightning fast, and includes a free-forever plan.
What is marketstack?
marketstack is a REST API that allows you to access stock data for public companies at 72 global exchanges including the New York Stock Exchange, the Nasdaq, the Tokyo Stock Exchange, and the London Stock Exchange.
marketstack delivers real-time market data, accurate to a single minute, ensuring that the information you base your decisions on, and the information you pass on to your customers, is always up to date.
There are more than 125,000 stock tickers, from over 50 different countries; you can query stocks, or over 75 different market indices; intraday market data is included, meaning you can monitor trades that close at the end of the day; you can even retrieve data about time-zones and international currencies.
Why Choose marketstack
marketstack uses cutting-edge technology to deliver market data in an easy-to-integrate JSON format, which is lightweight and incredibly easy to dig into.
Requests are made via a simple HTTP GET call, and all requests are run through bank-quality 256-bit HTTPS encryption. Whatever code stack you’re using, whether it’s PHP, Python, Node, or plain old JavaScript, marketstack provides comprehensive documentation to get your team up to speed in mere minutes.
The highly reliable cloud infrastructure can handle anything from a few dozen requests per year, all the way up to millions of requests per day. Regardless of the scale of your project, marketstack is robust and flexible enough to handle it.
It’s Not Just About Money
marketstack isn’t just about the bulls and bears of markets, in the tech sector specifically, stock price is an indicator of wider business trends and performance.
When Apple became the first US company to reach a $2 trillion valuation, not only was its stock price central to the story, but it indicated a trend in the tech giant’s dominance that went beyond cold hard cash.
When an eccentric billionaire makes outrageous, and ill-judged comments, and tanks his company’s valuation, the fluctuations in stock price are a big part of the story.
Beyond the spin of politicians, the market index of different exchanges is an indication of what analysts with in-depth knowledge really think during an election campaign.
With over 30 years of historical data, marketstack is a history of business, particularly the burgeoning tech sector, and makes that history available with a simple to use API.
marketstack’s Rock Solid API
marketstack’s API is built on top of apilayer technology, one of the most respected, and trusted API providers in the world, with a huge amount of experience delivering data reliably. Millions of API requests can be run through the API hourly, and it still has almost 100% uptime.
Any API is only as good as the data it supplies, and marketstack’s data is supplied by numerous high-authority providers around the globe, resulting in unprecedented accuracy.
As a result, marketstack is trusted by over 30,000 companies — including Microsoft, Amazon, Uber, and Credit Suisse — and 80+ universities.
Getting Started with marketstack
marketstack is entirely free for up to 1000 requests per month, with access to 1 year of historical data, as well as end-of-day data. No credit card is required to get started, and you’ll never be billed. This is the perfect option for simple integrations, or developers working on proof-of-concept builds. What we really like about marketstack is that the free package is genuinely usable. It’s not just a trial version that presses you into upgrading.
For anyone who needs more comprehensive data, packages that include market indices, technical support, and commercial use permissions, start at $9.99 per month, or just $7.99 per month when billed annually.
Head over the marketstack today to claim your free API key, and get started.
[– This is a sponsored post on behalf of marketstack –]
How to Make a Media Query-less Card Component
Fun fact: it’s possible to create responsive components without any media queries at all. Certainly, if we had container queries, those would be very useful for responsive design at the component level. But we don’t. Still, with or without container queries, we can do things to make our components surprisingly responsive. We’ll use concepts from Intrinsic Web Design, brought to us by Jen Simmons.
Let’s dive together into the use case described below, the solutions regarding the actual state of CSS, and some other tricks I’ll give you.
A responsive “Cooking Recipe” card
I recently tweeted a video and Pen of a responsive card demo I built using a recipe for pizza as an example. (It’s not important to the technology here, but I dropped the recipe at the end because it’s delicious and gluten free.)
Responsive Pizza Recipe Component without Media Queries.https://t.co/upft4Vpkp1
Work in progress based on a design by @WalterStephanie. Have fun resizing your browser window ? pic.twitter.com/FHK2ghMb91
— Geoffrey Crofte ? (@geoffreycrofte) July 18, 2020
The demo here was a first attempt based on a concept from one of Stéphanie Walter‘s talks. Here is a video to show you how the card will behave:
And if you want to play with it right now, here’s the Pen.
Let’s define the responsive layout
A key to planning is knowing the actual content you are working, and the importance of those details. Not that we should be hiding content at any point, but for layout and design reasons, it’s good to know what needs to be communicated first and so forth. We’ll be displaying the same content no matter the size or shape of the layout.
Let’s imagine the content with a mobile-first mindset to help us focus on what’s most important. Then when the screen is larger, like on a desktop, we can use the additional space for things like glorious whitespace and larger typography. Usually, a little prioritization like this is enough to be sure of what content is needed for the cards at any and all viewport sizes.
Let’s take the example of a cooking recipe teaser:
In her talk, Stéphanie had already did the job and prioritized the content for our cards. Here’s what she outlined, in order of importance:
- Image: because it’s a recipe, you eat with your eyes!
- Title: to be sure what you’re going to cook.
- Keywords: to catch key info at the first glance.
- Rating info: for social proof.
- Short description: for the people who read.
- Call to action: what you expect the user to do on this card.
This may seem like a lot, but we can get all of that into a single smart card layout!
Non-scalable typography
One of the constraints with the technique I’m going to show you is that you won’t be able to get scalable typography based on container width. Scalable typography (e.g. “fluid type”) is commonly done with the with viewport width (vw
) unit, which is based on the viewport, not the parent element.
So, while we might be tempted to reach for fluid type as a non-media query solution for the content in our cards, we won’t be able to use fluid type based on some percentage of the container width nor element width itself, unfortunately. That won’t stop us from our goal, however!
A quick note on “pixel perfection”
Let’s talk to both sides here…
Designers: Pixel perfect is super ideal, and we can certainly be precise at a component level. But there has to be some trade-off at the layout level. Meaning you will have to provide some variations, but allow the in-betweens to be flexible. Things shift in responsive layouts and precision at every possible screen width is a tough ask. We can still make things look great at every scale though!
Developers: You’ll have to be able to fill the gaps between the layouts that have prescribed designs to allow content to be readable and consistent between those states. As a good practice, I also recommend trying to keep as much of a natural flow as possible.
You can also read the Ahmad’s excellent article on the state of pixel perfection.
A recipe for zero media queries
Remember, what we’re striving for is not just a responsive card, but one that doesn’t rely on any media queries. It’s not that media queries should be avoided; it’s more about CSS being powerful and flexible enough for us to have other options available.
To build our responsive card, I was wondering if flexbox would be enough or if I would need to do it with CSS grid instead. Turns out flexbox in indeed enough for us this time, using the behavior and magic of the flex-wrap
and flex-basis
properties in CSS.
The gist of flex-wrap
is that it allows elements to break onto a new line when the space for content gets too tight. You can see the difference between flex with a no-wrap value and with wrapping in this demo:
The flex-basis
value of 200px is more of an instruction than a suggestion for the browser, but if the container doesn’t offer enough space for it, the elements move down onto a new line. The margin between columns even force the initial wrapping.
I used this wrapping logic to create the base of my card. Adam Argyle also used it on the following demo features four form layouts with a mere 10 lines of CSS:
In his example, Adam uses flex-basis and flex-grow (used together in flex shorthand property) )to allow the email input to take three times the space occupied by the name input or the button. When the browser estimates there is not enough rooms to display everything on the same row, the layout breaks itself into multiple lines by itself, without us having to manage the changes in media queries.
I also used clamp()
function to add even more flexibility. This function is kind of magical. It allows us to resolve a min()
and a max()
calculation in a single function. The syntax goes like this:
clamp(MIN, VALUE, MAX)
It’s like resolving a combination of the max()
and min()
functions:
max(MIN, min(VAL, MAX))
You can use it for all kind of properties that cover: ,
,
,
,
,
, or
.
The “No-Media Query Responsive Card” demo
With all of these new-fangled CSS powers, I created a flexible responsive card without any media queries. It might be best to view this demo in a new tab, or with a 0.5x option in the embed below.
Something you want to note right away is that the HTML code for the 2 cards are exactly the same, the only difference is that the first card is within a 65% wide container, and the second one within a 35% wide container. You can also play with the dimension of your window to test its responsiveness.
The important part of the code in that demo is on these selectors:
.recipe
is the parent flex container..pizza-box
is a flex item that is the container for the card image..recipe-content
is a second flex item and is the container for the card content.
Now that we know how flex-wrap
works, and how flex-basis
and flex-grow
influence the element sizing, we just need to quickly explain the clamp()
function because I used it for responsive font sizing in place of where we may have normally reached for fluid type.
I wanted to use calc()
and custom properties to calculate font sizes based on the width of the parent container, but I couldn’t find a way, as a 100% value has a different interpretation depending on the context. I kept it for the middle value of my clamp()
function, but the end result was over-engineered and didn’t wind up working as I’d hoped or expected.
/* No need, really */
font-size: clamp(1.4em, calc(.5em * 2.1vw), 2.1em);
Here’s where I landed instead:
font-size: clamp(1.4em, 2.1vw, 2.1em);
That’s what I did to make the card title’s size adjust against the screen size but, like we discussed much earlier when talking about fluid type, we won’t be able to size the text by the parent container’s width.
Instead, we’re basically saying this with that one line of CSS:
I want the
font-size
to equal to 2.1vw (2.1% of the viewport width), but please don’t let it go below 1.4em or above 2.1em.
This maintains the title’s prioritized importance by allowing it to stay larger than the rest of the content, while keeping it readable. And, hey, it still makes grows and shrinks on the screen size!
And let’s not forget about responsive images, The content requirements say the image is the most important piece in the bunch, so we definitely need to account for it and make sure it looks great at all screen sizes. Now, you may want to do something like this and call it a day:
max-width: 100%;
height: auto;
But that’s doesnt always result in the best rendering of an image. Instead, we have the object-fit
property, which not only responds to the height and width of the image’s content-box, but allows us to crop the image and control how it stretches inside the box when used with the object-position
property.
img {
max-width: 100%;
min-height: 100%;
width: auto;
height: auto;
object-fit: cover;
object-position: 50% 50%;
}
As you can see, that is a lot of properties to write down. It’s mandatory because of the explicit width and height properties in the HTML code. If you remove the HTML part (which I don’t recommend for performance reason) you can keep the
object-*
properties in CSS and remove the others.
An alternative recipe for no media queries
Another technique is to use flex-grow
as a unit-based growing value, with an absurdly enormous value for flex-basis
. The idea is stolen straight from the Heydon Pickering’s great “Holy Albatross” demo.
The interesting part of the code is this:
/* Container */
.recipe {
--modifier: calc(70ch - 100%);
display: flex;
flex-wrap: wrap;
}
/* Image dimension */
.pizza-box {
flex-grow: 3;
flex-shrink: 1;
flex-basis: calc(var(--modifier) * 999);
}
/* Text content dimension */
.recipe-content {
flex-grow: 4;
flex-shrink: 1;
flex-basis: calc(var(--modifier) * 999);
}
Proportional dimensions are created by flex-grow
while the flex-basis
dimension can be either invalid or extremely high. The value gets extremely high when calc(70ch - 100%)
, the value of --modifier
, reaches a positive value. When the values are extremely high each of them fills the space creating a column layout; when the values are invalid, they lay out inline.
The value of 70ch acts like the breakpoint in the recipe component (almost like a container query). Change it depending on your needs.
Let’s break down the ingredients once again
Here are the CSS ingredients we used for a media-query-less card component:
- The
clamp()
function helps resolve a “preferred” vs. “minimum” vs. “maximum” value. - The
flex-basis
property with a negative value decides when the layout breaks into multiple lines. - The
flex-grow
property is used as a unit value for proportional growth. - The
vw
unit helps with responsive typography. - The
object-fi
t property provides finer responsiveness for the card image, as it allows us to alter the dimensions of the image without distorting it.
Going further with quantity queries
I’ve got another trick for you: we can adjust the layout depending on the number of items in the container. That’s not really a responsiveness brought by the dimension of a container, but more by the context where the content lays.
There is no actual media query for number of items. It’s a little CSS trick to reverse-count the number of items and apply style modifications accordingly.
The demo uses the following selector:
.container > :nth-last-child(n+3),
.container > :nth-last-child(n+3) ~ * {
flex-direction: column;
}
Looks tricky, right? This selector allows us to apply styles from the last-child and all it’s siblings. Neat!
Una Kravets explains this concept really well. We can translate this specific usage like this:
.container > :nth-last-child(n+3)
: The third .container element or greater from the last .container in the group..container > :nth-last-child(n+3) ~ *
: The same exact thing, but selects any .container element after the last one. This helps account for any other cards we add.
Hugo Giraudel’s “Selectors Explained” tool really helps translate complex selectors into plain English, if you’d like another translation of how these selectors work.
Another way to get “quantity” containers in CSS is to use binary conditions. But the syntax is not easy and seems a bit hacky. You can reach me on Twitter if you need to talk about that — or any other tricks and tips about CSS or design.
Is this future proof?
All the techniques I presented you here can be used today in a production environment. They’re well supported and offer opportunities for graceful degradation.
Worst case scenario? Some unsupported browser, say Internet Explorer 9, won’t change the layout based on the conditions we specify, but the content will still be readable. So, it’s supported, but might not be “optimized” for the ideal experience.
Maybe one day we will finally get see the holy grail of container queries in the wild. Hopefully the Intrinsic Web Design patterns we’ve used here resonate with you and help you build flexible and “intrinsicly-responsive” components in the meantime.
Let’s get to the “rea” reason for this post… the pizza! ?
Gluten free pan pizza recipe
You can pick the toppings. The important part is the dough, and here is that:
Ingredients
- 3¼ cups (455g) gluten free flour
- 1 tablespoon, plus 1 teaspoon (29g) brown sugar
- 2 teaspoons of kosher salt
- 1/2 cube of yeast
- 2½ cups (400 ml) whole almond milk
- 4 tablespoons of melted margarine
- 1 tablespoon of maizena
Instructions
- Mix all the dry ingredients together.
- Add the liquids.
- Let it double size for 2 hours. I’d recommend putting a wet dish towel over your bowl where the dough is, and place the dish close to a hot area (but not too hot because we don’t want it to cook right this second).
- Put it in the pan with oil. Let it double size for approximately 1 hour.
- Cook in the oven at 250 degrees for 20 minutes.
Thanks Stéphanie for the recipe ?
The post How to Make a Media Query-less Card Component appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
Come to Web Unleashed!
(This is a sponsored post.)
Web Unleashed is a fun conference. I’ve been a number of times. I’m sure you won’t be surprised that it’s online this year, like most events.
And, hey, it’s coming up and will take place over three days, October 5-7, 2020. I’d really like to see you there, not just because you’re going to get a lot of it (which you will), but because I’ll be there emceeing the show on October 5th, right after Jason Pamental does the opening. I’m also interviewing a wonderful mystery guest which is sure to be both fun and interesting.
But you can expect much, much more over the three days that Web Unleashed takes place. I mean, just look at the lineup.
Tickets are $249 Canadian. If you’re looking for a discount, I’ve got one right here that will knock $100 off the registration. Use coupon code CSS-Tricks
when registering for the event to get the special price. Just make sure you do it soon because it’s only valid until September 10. And, yes, group discounts are also available. I’m gonna say that again but bigger:
Use coupon CSS-Tricks because it’s literally 40% off the already-affordable ticket price, but you have to do it before September 10, 2020.
Oh, and one more thing! Check out the artwork for the event:
It’s beautiful, right? That was done by Matt Deslauriers and was the inspiration behind a little tool I put together that creates random generative art that can be exported as SVG and PNG. I told you his was way cooler.
Direct Link to Article — Permalink
The post Come to Web Unleashed! appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
Guide to Effective B2B Marketing for 2020
Even before the COVID-19 pandemic, the prospect of a contentious election in the United States and lackluster financial projections worldwide were clouding business horizons. Business-to-business (B2B) marketers’ strategies for 2020 are “overridden by one factor more than any other: uncertainty,” says Polly Kay, senior marketing manager at English Blinds.
Compounding the grim human costs of the pandemic, the economic disruption has pulled the rug out from under B2B marketing departments that traditionally rely on trade shows for face-to-face introductions to new clients. The spread of COVID-19 across the world forced cancellation of approximately 500 trade shows worldwide, erasing 270,000 full-time equivalent (FTE) jobs worldwide and $26.2 billion per month in global economic activity.
“B2B firms are already seeing the beginnings of disruptions that are going to continue throughout the rest of the year, and quite possibly beyond it, too,” Kay says.
How can you adapt your B2B marketing to cope with this extreme situation? How can you keep your lead funnel full when events, the largest slice of most B2B marketing budgets, are suspended? What are the best ways to nurture leads into deals using digital channels exclusively?
We worked with experts to find the answers, which we offer in this comprehensive guide to B2B marketing for 2020.
Chapter synopsis
This guide consists of five chapters:
- Chapter 1: Introduction.
- Chapter 2: What is B2B marketing? What defines B2B marketing? How does it differ from B2C marketing? We cover the basics as well as the trends in the industry both now and in the future.
- Chapter 3: Top B2B marketing KPIs. We discuss the key performance indicators B2B marketers need to track, and review some leading apps and digital tools to automate metric tracking.
- Chapter 4: The most effective B2B marketing channels. Flip ahead to this chapter to learn more about the major marketing channels from a B2B perspective — social media, email, video, and search — as well as the state of event-based B2B marketing.
- Chapter 5: Examples of great B2B marketing. Lessons from six of the top B2B marketing campaigns of years past.
Each chapter stands on its own, so feel free to skip ahead for answers to specific questions. And remember to bookmark this page. Much of what we cover is evergreen. The lessons we’re learning now may prove remarkably useful in the inevitable crises to come.
What is B2B marketing?
What do local radio spots aimed at small business owners, a business networking happy hour, volunteering on the board of the local chamber of commerce, and making presentations at trade shows have in common? Each is an example of B2B marketing, a term that encompasses so much that it’s hard to define succinctly.
What is B2B marketing?
Let’s break the term down into its component parts. B2B stands for “business-to-business.” Compare B2B companies to B2C, or “business-to-consumer,” operations. If you sell candy bars to the general public, you operate a B2C business. If you sell boxes of candy bars to corporate employee snack programs, you’re in the B2B space.
Here’s the American Marketing Association’s definition of marketing:
Marketing is the activity, set of institutions, and processes for creating, communicating, delivering, and exchanging offerings that have value for customers, clients, partners, and society at large.
To put it all together, B2B marketing involves communicating one company’s products or services (including software as a service) to other businesses and organizations. B2B is marketing between companies, as opposed to marketing by one company to the public at large.
B2C vs B2B marketing
Consumers are individuals who purchase products or services from a company. Most successful B2C marketing campaigns use simple messaging, emotional arguments, and wide targeting.
The B2B audience is different. They are much more analytical when making purchasing decisions. Far less interested in fads, they value what improves productivity and eliminates waste. Business buyers demand to know exactly how your offering is worth their money. Here’s a snapshot of the B2B vs B2C marketing dichotomy:
- In B2B marketing, there is rarely a single decision-maker. More often than not, it’s a team of people. In a sense, “business-to-business” is a misnomer. All marketing is between people, after all. But in the B2B space, you may have to address the needs and preferences of multiple stakeholders within a company to seal the deal. B2C campaigns are more likely to rely on emotional appeals to an individual.
- The B2B sales cycle is a lot longer than B2C. On one hand, this means there are more opportunities for your prospects to jump ship. But it also means you have more time to share crucial, decision-changing information and to cultivate a relationship for the long run.
- B2B marketing campaigns are more data driven than B2C campaigns. A chief financial officer isn’t persuaded because your copy is pithy. They care how your business will provide a good return on investment. You need numbers to make your case.
For more on the differences between B2B and B2C marketing, check out our blog.
The unique characteristics of B2B marketing are clear when you examine recent industry trends. Below are some key B2B marketing trends already gaining momentum and what some experts believe marketers can expect in the years to come.
B2B marketing trends
Digital connections have been increasingly important for B2B marketers for years, and the pandemic will accelerate that trend, says Lance Cummins, founder of Nectafy and Anyvoo.
“What you’re seeing now is a huge acceleration of a gradual trend, which is that you’ve got to learn to deal with your audience digitally,” Cummins says. “You’ve got to get people to pay attention to you, even if you’re not physically standing in their way at a trade show.”
The numbers support Cummins’s point. In 2019, U.S. marketing spend for offline media declined by 5.9 percent, reports Winterberry Group’s Outlook for Data Driven Advertising & Marketing 2020, while budgets for online marketing efforts grew 19.1 percent.
Two of the three traditional marketing categories that helped offset the overall decline in offline spending in 2019 were outdoor media (billboards, posters) and experiential marketing (events). It seems likely that widespread stay-at-home orders will affect those two categories in 2020, hastening the decline of traditional marketing channels.
Here are a few more of the trends marketers are following this year:
- Content marketing remains a big part of digital attention seeking, but increasingly savvy B2B audiences will demand higher quality, demonstrably useful material, Cummins says. “The future of content marketing, and this is not revolutionary, is literally about this: How do we provide more substantive help?” he says. “The noise is so much greater [in 2020]; therefore your focus has to be narrower. Your expertise has to be more helpful rather than self-interested.”
- Marketers in the coming years will benefit from a shift in branding away from the company toward the individuals who work there, says Alex Panagis, founder of ScaleMath. “In previous years, businesses would choose to work with a specific company because of the name value in the industry,” Panagis says. “That is not really the case anymore. Businesses buy into people they like and believe share the same common values as them.” To take advantage of this trend, consider positioning employees as thought leaders, investing in their personal brands, and nurturing their personal audiences.
- In the near future, personalized messaging, not big data, could be what makes the difference between gaining a lead and driving one away. “In previous years, everyone has been too focused on automating their marketing, sending templated and canned emails to get maximum results with the minimum investment,” says Adam Hempenstall, CEO and founder of Better Proposals. “It’s not working anymore, and B2B audiences crave personalization. Take your time, craft personalized marketing messages, and you will see your open rates and response rates increase significantly.”
If you invest in these suggestions, how will you measure your results? B2B marketers must collect data to verify the effectiveness of their efforts — which brings us to the subject of marketing KPIs.
Top B2B marketing KPIs
Key performance indicators, or KPIs, are the metrics that describe an organization’s progress toward its most important goals. KPIs range from broad data points, such as total yearly profit and sales by region, to very granular information, like contact volume by channel and new vs repeat site visits per month.
Every part of an enterprise has its own set of KPIs. Marketers use KPIs to track their successes and make necessary improvements — which is why we call them “key.”
Which KPIs are most important for marketers to track? That depends entirely on your goals. Here are 10 KPIs that no experienced marketer will ignore.
10 B2B marketing KPIs
- Site traffic. Most B2B websites serve multiple functions: They’re online sales hubs, industry resources, and communication points for customers. But no function is more important than generating leads. The more visitors you have, the more opportunities you have to convert those visitors into leads.
- Return on ad spend (ROAS). Did your last pay-per-click (PPC) campaign generate a profit? Did you target the right markets on your last billboard spend? Tracking ROAS is the only way to find out.
- Cost per lead (CPL). Every lead costs something. Tracking fluctuations in that cost over time can tell you a lot about inbound marketing and other lead-generation efforts. “That number should be coming down over time, if you’re doing a good job,” Cummins says. If it doesn’t, reconsider your strategy.
- Average revenue per customer (ARPC). Knowing the value of each customer makes it easier to allocate an effective marketing budget for both retention and drawing in new business.
- Conversion rates. Don’t just measure conversion rates in terms of sales but at each stage of the marketing funnel. “In content marketing, that’s going to be visitors to leads to some point in your sales process, down to becoming a customer,” Cummins says. “You need to have some sort of insight into conversion rates along those lines.”
- Click-through rate (CTR). This metric is crucial for measuring the effectiveness of PPC ad campaigns. The organic click-through rate measures how many visitors reach your site through search. This is an extremely important measure of the effectiveness of content marketing campaigns.
- Contact form conversions. Are your contact forms performing up to their full potential? Do you need to redesign them or place them somewhere else on your site? Find out by tracking the number of contact form impressions versus form completions.
- Customer churn. This is a ratio of the number of lost customers to the total number of customers at the beginning of the study period. A high churn rate indicates a problem. Either you’re not satisfying customers, or you need to invest in customer retention marketing strategies.
- Pipeline velocity. Measure how long it takes for a prospect to move through your B2B marketing funnel, from lead to customer. This figure tells you how effectively you’re nurturing leads. The B2B sales cycle is notoriously longer than B2C, but targeted marketing campaigns speed it up.
- Customer satisfaction. Wait a second, you might say. Isn’t this a customer service metric rather than a marketing KPI? Not necessarily. Customer satisfaction is the main goal of any successful business. Dissatisfied customers are an indication that your marketing materials are overpromising or misrepresenting your offerings.
Now that you have a few B2B marketing metrics to track, you’ll need tools to make sense of all those numbers. There are plenty of SaaS options, and even many free online tools, that provide KPI tracking and analytics for B2B marketers.
B2B marketing analytics tools
Your KPI numbers are just raw data. Turning that data into usable intelligence requires analytics tools. Every digital channel you use, from search engines to each individual social media account, generates its own data. Most of these services offer some degree of native analytics, but logging into every one of them every time makes it hard to write meaningful reports.
Marketers use analytics tools to organize the data from a wide variety of sources. Marketers and executives build custom dashboards — personalized analytics pages that display data visually — to gauge a campaign’s success against particular goals on a single screen.
Here are some of the leading marketing analytics tools on the market:
- Adobe Analytics. Adobe’s enterprise-level analytics software tracks both online and offline data, with advanced AI algorithms for predictive analysis. But this full-service analytics platform prices out many small and medium-sized businesses. One recent review estimated costs of between $30,000 and $350,000 per year.
- Google Analytics. The free version of Google Analytics is an essential tool for measuring site traffic, onsite behavior, pay-per-click effectiveness, and any number of conversion types. If a data point ties into your website, Google Analytics can probably track it. If you were starting a digital-only marketing analytics project from scratch, this would be a good place to start. The free version provides plenty of data, but a paid version — Google Analytics 360 — provides enterprise-level services on par with Adobe Analytics (with pricing reportedly around $150,000).
- HubSpot. HubSpot is an integrated growth platform that combines a free customer resource management tool with related software hubs for sales, customer service, and marketing. HubSpot’s analytics focus on inbound marketing KPIs to help marketers convert visitors into leads and leads into customers. Pricing depends on the number of leads you wish to track as well as access to advanced services. The Marketing Hub ranges from $50 per month to $3,200 per month at the time of this writing.
- SEMRush. Like its competitor, Moz, SEMRush provides marketing analytics specifically for search engine optimization (SEO). It’s built to track SEO-related KPIs like site traffic, CTR, and keyword rankings. Both SEMRush and Moz start at just $99 per month. While each platform has its partisans, the general opinion is that Moz is easier to use for beginners, while SEMRush is more powerful for experienced digital marketers.
Analytics platforms segment your data, but not all of them automatically import data from all channels — especially if you go beyond digital marketing. Before choosing an analytics platform, consider which channels your audience engages with. Let’s look at the leading marketing channels B2B marketers use to draw in new leads and turn them into customers.
The most effective B2B marketing channels
Marketers are naturally focused on their messaging, but where a message appears is as important as any nuance of wording. Placement is an acute consideration for the full range of media channels, from magazines and billboards to search engines, social media, and email.
It doesn’t matter how great your message is if you don’t place it where your customers will engage with it. Your B2B marketing begins with a thorough understanding of your customers, their needs, and where they seek information on products and services relevant to their business. When you have that mapped out, you can determine whether to focus on social, search, or some other space entirely.
Here are some of the most powerful B2B marketing channels that will build and replenish your sales funnel for a continuous supply of leads, no matter how challenging the business environment.
Social media marketing
Facebook, Instagram, Twitter, LinkedIn, even Reddit, are all powerful platforms for B2B marketers to connect with audiences. Facebook is famous for its low-cost, broad-reach PPC platform. Paid social ads on LinkedIn cost more but typically bring in better B2B leads. (Learn more about the difference between Facebook and LinkedIn for B2B PPC advertising on our blog.)
Social media is much more than just the place for PPC ads, says Ambreen Sharif, cofounder and digital marketing consultant at Workplay Digital. Organic shared media dovetails well with other channels, both online and offline.
“Use LinkedIn to promote your upcoming webinar or offline event,” Sharif says. “Your followers will share it with their networks, colleagues, and friends. Even if they just ‘like’ your post, it’s more likely to appear in their network’s feed.”
Email marketing
Email marketing is still going strong in 2020 — just look at the “promotions” tab in any professional’s inbox. The question is, how can marketers best leverage this outbound strategy when an email open rate of 15 to 25 percent is considered high?
“You face a difficult task, to go from unwelcome spam to welcome business conversation,” says Cummins. “That is a tough, tough transition.”
Instead, he says, permission-based email outreach may soon generate more value as the world embraces the EU’s General Data Protection Regulation (GDPR), which requires marketers to allow recipients to opt out of email campaigns.
“Email is still essentially the hub of how business works,” Cummins says. “It’s critical.” Just be sure to ask for permission to stay on the right side of your audience. One easy way to begin these customer-driven email relationships is to post an email list form on your website so that visitors can subscribe to your newsletters or updates.
Video marketing
Most internet users watch video online, but that doesn’t mean B2B customers have stopped reading. “I don’t see video marketing as a standalone approach,” says Cummins. “It crosses all channels. You’ve got to integrate it.” Cummins advises adding video clips to outbound emails, or using them to enhance written content. “It has to have a place to live and breathe,” he says.
Regardless of where you post video content, the medium is ideal for explaining complex subjects. Sharif recommends beginning your video strategy with an “explainer video” that clearly explains a difficult subject within your industry.
“Choose a topic that you’re an expert in and that would be of interest to your audience,” she says. “Create a short, high-quality video explaining the concept in simple terms. It’s valuable, it’s shareable, and it demonstrates your expertise in a creative way.”
Event marketing
Prior to the COVID-19 pandemic, the exhibition industry had been growing steadily for years. As recently as the third quarter of 2019, it grew by 0.6 percent because, by one estimate, exhibiting at a trade show can reduce the cost of a sale by up to 75 percent.
The coronavirus has disrupted trade shows, at least for the time being. The Center for Exhibition Industry Research estimates that up to 80 percent of U.S. trade shows planned for March 1 through May 15 had been canceled. However, CEIR economist Allen Shaw told Trade Show News Network, “Since this is a transitory event, we expect a full recovery for the exhibition industry in 2021.”
Trade shows will return eventually, because there is no real substitute for handling a product and discussing it with someone who can answer all your questions. Sharif advises using this down time to determine how to drive higher attendance in future years.
“It’s not enough to just show up, hand out some business cards and hope for the best,” she says. “It’s worth the extra investment to have a speaking opportunity to demonstrate your expertise and showcase an all-star on your team who’s not only an expert but an engaging and personable speaker.”
Event marketing isn’t an entirely offline strategy. Enhance your booth or presentation by using mobile devices to access on- or offline mobile data-collection forms that let you collect lead information anywhere on the exhibition floor.
Content marketing
“Content marketing” refers to the production and publication of helpful materials that are offered for free to a valuable audience. It’s part of the broader technique of “inbound marketing,” which encourages clients to reach out to the selling company rather than the other way around.
Nearly 90 percent of B2B purchasers perform online research when looking for a new product or service. This makes an inbound marketing strategy extremely valuable to B2B companies. Providing candid answers to your audience’s research questions is powerful. Never doubt that good content will surface at the top of their search results.
Engaging with savvy B2B audiences requires a content strategy focused on the reader. Cummins advises marketers to ask themselves two questions as they work on content: “What is the user looking for? And, are we providing that in a really helpful, engaging, intelligent way, human to human?” Successful inbound marketing content boils down to a single two-word goal, Cummins says: “Be helpful.”
Marketing channels don’t exist in a vacuum. Some of the most successful B2B marketing campaigns of the past few years used multiple channels to reach highly specific audiences. To learn what may work in the future, let’s take a look at the B2B marketing efforts that produced great returns in the past.
Examples of great B2B marketing
The suspension of in-person events has been a setback for gregarious B2B marketers, but even when trade shows were going strong, many of the most effective campaigns of recent years were on digital channels.
If you’re looking for alternatives to your usual booth at a trade show, start by looking at a few digital campaigns. These pre-2020 B2B marketing campaigns demonstrate an impressive range of innovation and can help you navigate this unusual business environment.
Upwork: Hey World
“Remember that even with B2B marketing, you’re speaking to a person,” says Sharif. “Ultimately, people are making purchasing decisions, and they’re the ones you have to win over.”
Humor, pop culture fluency, and a touch of irreverence all win people over. The freelancer platform Upwork used all three in its 2018 “Hey World” campaign, which featured (gentle) trash-talking copy like, “Hey Mr. President! Need a social media strategist?” and “Hey Comic Sans user! Need some graphic design help?”
The campaign made the argument that Upwork’s freelancers can help with any business challenge confronting the viewer. It played out on billboards, digital video, and radio, and won a Drum B2B Award for best brand campaign in 2018.
Square: Town Square
Digital payments company Square doesn’t call its flagship content marketing page a “blog.” They call it the Town Square Business Resource Center to reflect the company’s commitment to providing not just “content” but resources.
This is where Square publishes useful information for a small business audience, which helps boost traffic via search. Square’s writers cover regulatory updates and growth strategies, as well as personal stories of business success. It’s all easily searchable, with filters based on topic, business type, and content type.
Town Square demonstrates Square’s investment in its customers, according to Khobi Brooklyn, who was the director of product communications and marketing at Square during the rollout of the campaign. Brooklyn told First Round Review that “it’s important to show how much you value your customers. We try to take every chance we have to celebrate small business owners, because that’s core to who Square is.”
Dropbox: Marketing Dynamix
Dropbox has evolved from a file-sharing platform into a “smart workplace” innovator focused on new audiences in the business world. In 2017, Dropbox launched an interactive campaign just for marketers called “Marketing Dynamix.”
Through multichannel outreach, Dropbox invited marketers to take a personality test to answer the question, what kind of marketer are you? Individual team members were categorized as one of a variety of marketer types so team leaders could plan more effective communications strategies.
A dedicated Marketing Dynamix microsite allowed visitors to take the test, share results, and browse personalized content based on results. By the end of 2018, the campaign had generated more than 2,000 marketing qualified leads and an estimated return on investment of 25 to 1.
HP: The Wolf
Christian Slater stars as a nefarious hacker in a tense narrative thriller — but this wasn’t the TV series Mr. Robot. It’s “The Wolf,” an online video ad campaign from HP. The company took its cue from Hollywood rather than PowerPoint, a rarity in the B2B media ecosystem.
The dramatic series originally streamed on YouTube. It kept viewers on the edges of their seats while illustrating the danger of an unsecured business printer. That security risk is, of course, a problem that HP solves with its line of secured smart printers.
By aiming at the pulse of the business audience, rather than its spreadsheets, “The Wolf” racked up more than 12 million YouTube views in its first two months. The campaign also appeared in 118 earned media placements globally. The flagging printer industry saw B2B sales increase by 6 percent.
This series highlights the value of high-quality storytelling in video marketing campaigns in the B2B space, even if you don’t have the kind of budget HP invested in “The Wolf.”
PathFactory: GDPR Wars
After the European Union implemented the General Data Protection Regulation (GDPR) in 2018, business prospects were inundated with requests for email marketing opt-ins, as required by the standard. These requests were typically dense with legalese that prospects found easy to ignore. An alarming number responded by opting out, not in.
Knowing that its email would be just one among many, content platform PathFactory took a different approach. The company’s marketers framed its opt-in request in terms of a pop culture icon: Star Wars.
GDPR Wars was a single opt-in email that, in three paragraphs, positioned GDPR as a rebellion against impersonal marketing and aligned PathFactory with the “good guys” while fully complying with the new rules for opting in to email contact.
The GDPR Wars email outperformed previous PathFactory email campaigns by 241 percent. It garnered lots of shared media and won a Demand Gen Report Killer Content Award. The lesson?
“If GDPR Wars teaches you anything it’s that you should not be afraid to have fun in your marketing,” writes Evan Doyle on the PathFactory blog. “Regardless of how ‘dry’ the topic is, take some extra time and effort to inject your brand’s personality into your work. It will give your audience a reason to keep coming back.”
Samsung: Big & Small
Samsung released the Galaxy Note 8 in Europe with a content-rich campaign based on the premise of large and small businesses learning from each other. “Big & Small — How to Do Bigger Things in Business” featured an original study of business trends, an in-person panel debate, and two short films documenting how employees use the Galaxy Note 8 in their daily lives.
The film about big business, called “Aiming Higher,” is a masterclass in the power of video to show the value of a product. “Aiming Higher” follows an international sales director at an unnamed but clearly global B2B company.
The sales director rhapsodizes about his Galaxy Note 8 with a long list of concrete examples of its usefulness. The video positions Samsung’s device as a “mobile office,” ideal for fast-paced B2B operators.
In total, Big & Small led to a 26 percent increase in B2B sales for Samsung over the previous year. The content reached more than 10 million viewers throughout Europe and the films garnered 250,000 views.
B2B marketing beyond 2020: Continued digital growth
The global uncertainty of early 2020 will pass. Markets will rally, and marketers will return to trade shows. Global business leaders will again jet around the world to seal deals in person. But the marketing trends that the 2020 pandemic accelerated are unlikely to fade away.
“Companies have to figure out these questions,” Cummins says. “How do we leverage content online? How do we leverage other digital tools to get in front of people?”
No matter when you read this guide, in 2020 or after, digital communications remain crucial for great B2B marketing. Make those online connections with your audience using marketing templates from JotForm, which range from subscription forms to user experience surveys, and everything in between.