Your best customers don’t just buy one product or use your service once. They come back again and again for more. Customer retention increases your customers’ lifetime value and boosts your revenue. It also helps you build amazing relationships with your customers. You aren’t just another website or store. They trust you with their money because you give them value in exchange. What what does customer retention mean? And how can you achieve customer retention through relationship-building strategies? Let’s explore these concepts in depth and look at a few examples that you can apply to your own business. What is…
Leonardo da Vinci said, “Simplicity is the ultimate form of sophistication.” Whatever I’m designing, that is my mantra. It’s also one of the basic requirements for effective UI design. In order to attract, convert and retain, user interface must satisfy three criteria: It should be engaging, beautiful and elicit an emotional response from the user. The same applies to almost every other work of art; the only difference is, art can endure a certain dose of complexity. UI can’t. Being a vital part of UX, UI is one of the key factors that influence conversion rates. Conversion, on the other…
I have some bad news for you. It might hurt. Everything you’ve read about lead generation strategies might not apply to your business. Why? Because ecommerce lead generation is different. If you run a business outside the ecommerce family, feel free to check out another Crazy Egg article that applies to your company. For those of you in the ecommerce market, though, we need to set a few things straight. I’m going to share with you my best tips for effective ecommerce lead generation, and you might notice that they’re not the same as the tactics you might use for,…
Everything You Need To Know About Alignment In Flexbox
In the first article of this series, I explained what happens when you declare display: flex on an element. This time we will take a look at the alignment properties, and how these work with Flexbox. If you have ever been confused about when to align and when to justify, I hope this article will make things clearer!
History Of Flexbox Alignment
For the entire history of CSS Layout, being able to properly align things on both axes seemed like it might truly be the hardest problem in web design. So the ability to properly align items and groups of items was for many of us the most exciting thing about Flexbox when it first started to show up in browsers. Alignment became as simple as two lines of CSS:
The alignment properties that you might think of as the flexbox alignment properties are now fully defined in the Box Alignment Specification. This specification details how alignment works across the various layout contexts. This means that we can use the same alignment properties in CSS Grid as we use in Flexbox — and in future in other layout contexts, too. Therefore, any new alignment capability for flexbox will be detailed in the Box Alignment specification and not in a future level of Flexbox.
Many people tell me that they struggle to remember whether to use properties which start with align- or those which start with justify- in flexbox. The thing to remember is that:
justify- performs main axis alignment. Alignment in the same direction as your flex-direction
align- performs cross-axis alignment. Alignment across the direction defined by flex-direction.
Thinking in terms of main axis and cross axis, rather than horizontal and vertical really helps here. It doesn’t matter which way the axis is physically.
Main Axis Alignment With justify-content
We will start with the main axis alignment. On the main axis, we align using the justify-content property. This property deals with all of our flex items as a group, and controls how space is distributed between them.
The initial value of justify-content is flex-start. This is why, when you declare display: flex all your flex items line up against the start of the flex line. If you have a flex-direction of row and are in a left to right language such as English, then the items will start on the left.
Note that the justify-content property can only do something if there is spare space to distribute. Therefore if you have a set of flex items which take up all of the space on the main axis, using justify-content will not change anything.
If we give justify-content a value of flex-end then all of the items will move to the end of the line. The spare space is now placed at the beginning.
We can do other things with that space. We could ask for it to be distributed between our flex items, by using justify-content: space-between. In this case, the first and last item will be flush with the ends of the container and all of the space shared equally between the items.
We can ask that the space to be distributed around our flex items, using justify-content: space-around. In this case, the available space is shared out and placed on each side of the item.
A newer value of justify-content can be found in the Box Alignment specification; it doesn’t appear in the Flexbox spec. This value is space-evenly. In this case, the items will be evenly distributed in the container, and the extra space will be shared out between and either side of the items.
These values work in the same way if your flex-direction is column. You may not have extra space to distribute in a column however unless you add a height or block-size to the flex container as in this next demo.
If you have added flex-wrap: wrap to your flex container, and have multiple flex lines then you can use align-content to align your flex lines on the cross axis. However, this will require that you have additional space on the cross axis. In the below demo, my cross axis is running in the block direction as a column, and I have set the height of the flex container to 60vh. As this is more than is needed to display my flex items I have spare space vertically in the container.
I can then use align-content with any of the values:
As with justify-content, we are working with the lines as a group and distributing the spare space.
The place-content Shorthand
In the Box Alignment, we find the shorthand place-content; using this property means you can set justify-content and align-content at once. The first value is for align-content, the second for justify-content. If you only set one value then both values are set to that value, therefore:
We now know that we can align our set of flex items or our flex lines as a group. However, there is another way we might wish to align our items and that is to align items in relationship to each other on the cross axis. Your flex container has a height. That height might be defined by the height of the tallest item as in this image.
It might instead be defined by adding a height to the flex container:
The reason that flex items appear to stretch to the size of the tallest item is that the initial value of align-items is stretch. The items stretch on the cross access to become the size of the flex container in that direction.
Note that where align-items is concerned, if you have a multi-line flex container, each line acts like a new flex container. The tallest item in that line would define the size of all items in that line.
In addition to the initial value of stretch, you can give align-items a value of flex-start, in which case they align to the start of the container and no longer stretch to the height.
The value flex-end moves them to the end of the container on the cross axis.
If you use a value of center the items all centre against each other:
We can also do baseline alignment. This ensures that the baselines of text line up, as opposed to aligning the boxes around the content.
The align-items property means that you can set the alignment of all of the items at once. What this really does is set all of the align-self values on the individual flex items as a group. You can also use the align-self property on any individual flex item to align it inside the flex line and against the other flex items.
In the following example, I have used align-items on the container to set the alignment for the group to center, but also used align-self on the first and last items to change their alignment value.
A common question is why it is not possible to align one item or a group of the items on the main axis. Why is there no -self property for main axis alignment in Flexbox? If you think about justify-content and align-content as being about space distribution, the reason for their being no self-alignment becomes more obvious. We are dealing with the flex items as a group, and distributing available space in some way — either at the start or end of the group or between the items.
If might be also helpful to think about how justify-content and align-content work in CSS Grid Layout. In Grid, these properties are used to distribute spare space in the grid container between grid tracks. Once again, we take the tracks as a group, and these properties give us a way to distribute any extra space between them. As we are acting on a group in both Grid and Flexbox, we can’t target an item on its own and do something different with it. However, there is a way to achieve the kind of layout that you are asking for when you ask for a self property on the main axis, and that is to use auto margins.
Using Auto Margins On The Main Axis
If you have ever centered a block in CSS (such as the wrapper for your main page content by setting a margin left and right of auto), then you already have some experience of how auto margins behave. A margin set to auto will try to become as big as it can in the direction it has been set in. In the case of using margins to center a block, we set the left and right both to auto; they each try and take up as much space as possible and so push our block into the center.
Auto margins work very nicely in Flexbox to align single items or groups of items on the main axis. In the next example, I am achieving a common design pattern. I have a navigation bar using Flexbox, the items are displayed as a row and are using the initial value of justify-content: start. I would like the final item to be displayed separated from the others at the end of the flex line — assuming there is enough space on the line to do so.
I target that item and give it a margin-left of auto. This then means that the margin tries to get as much space as possible to the left of the item, which means the item gets pushed all the way over to the right.
If you use auto margins on the main axis then justify-content will cease to have any effect, as the auto margins will have taken up all of the space that would otherwise be assigned using justify-content.
Each alignment method details a fallback alignment, this is what will happen if the alignment you have requested can’t be achieved. For example, if you only have one item in a flex container and ask for justify-content: space-between, what should happen? The answer is that the fallback alignment of flex-start is used and your single item will align to the start of the flex container. In the case of justify-content: space-around, a fallback alignment of center is used.
In the current specification you can’t change what the fallback alignment is, so if you would prefer that the fallback for space-between was center rather than flex-start, there isn’t a way to do that. There is a note in the spec which says that future levels may enable this.
Safe And Unsafe Alignment
A more recent addition to the Box Alignment specification is the concept of safe and unsafe alignment using the safe and unsafe keywords.
With the following code, the final item is too wide for the container and with unsafe alignment and the flex container on the left-hand side of the page, the item becomes cut off as the overflow is outside the page boundary.
The alignment properties started as a list in Flexbox, but are now in their own specification and apply to other layout contexts. A few key facts will help you to remember how to use them in Flexbox:
justify- the main axis and align- the cross axis;
To use align-content and justify-content you need spare space to play with;
The align-content and justify-content properties deal with the items as a group, sharing out space. Therefore, you can’t target an individual item and so there is no -self alignment for these properties;
If you do want to align one item, or split a group on the main axis, use auto margins to do so;
The align-items property sets all of the align-self values as a group. Use align-self on the flex child to set the value for an individual item.
Google’s mobile first index has created quite an upheaval in the marketing world — and for good reason. If Google is taking mobile websites more seriously, shouldn’t you? After all, if you want Google to serve up your content to searchers, you need to know how Google crawls and assesses your website. Otherwise, you fall behind the competition. But don’t panic. If you don’t have a mobile website ready to go now, you’re not doomed to haunt the 100th page of the Google SERPs forever. In fact, Google is slowly rolling out this new strategy, roping in more websites as…
Consumers have become increasingly blind to marketing and advertising company. The buyer’s journey gets longer and longer, and people are slower to trust companies. What’s a business to do? Build credibility. And it starts with customer testimonials. Imagine that someone is looking for a product you sell. He calls a friend and asks for a recommendation. The friend suggests your product. That person buys from you based on the referral. Customer testimonials work the same way. Instead of communication between friends, it’s communication from one customer to the masses. There are two types of customer testimonials. One is user-generated content….
The ultimate end goal for every single visitor to your website is to turn them into a customer or a recurring visitor. The problem is that turning visitors into regulars can be tricky. Really tricky. There is, however, an easier way to convert visitors without wasting your time or theirs—and it comes in an unexpected form. Pop-up form, to be exact. Simply by using well placed popup forms, you can boost your email subscription rate by 317% or more. With this in mind, we’re going to take a look at our top seven pop-up recommendations and discover how they’ll help…
Have you ever thought, “If we could increase our traffic by X%, digital marketing would become so much easier”? If so, don’t worry—you’re not alone. Many companies choose to funnel a large percentage of their marketing spend into advertising, hoping to scale their business by attracting large numbers of new customers. Unfortunately, paid customer acquisition has become increasingly competitive and expensive. Steve Dennis writes for Forbes, “As it turns out, many online brands attract their first tranche of customers relatively inexpensively, through word of mouth or other low cost strategies. Where things start to get ugly is when these brands…
What’s WebP in the first place? Can we actually use it today? And if yes, how exactly? The role of media in performance, specifically images, is of huge concern. Images are powerful. Engaging visuals evoke visceral feelings. They can provide key information and context to articles, or merely add humorous asides. They do anything for us that plain text just can’t by itself.
But when there’s too much imagery, it can be frustrating for users on slow connections, or run afoul of data plan allowances. In the latter scenario, that can cost users real money. This sort of inadvertent trespass can carry real consequences.
In this eBook, you’ll learn all about WebP: what it’s capable of, how it performs, how to convert images to the format in a variety of ways, and most importantly, how to use it. Of course — the eBook is — and always will be, free for all Smashing Members.
This guide will encourage you to experiment and see what’s possible with WebP:
WebP images usually use less disk space when compared to other formats at reasonably comparable visual similarity. Depending on your site’s audience and the browsers they use, this is an opportunity to deliver less data-intensive user experiences for a significant segment of your audience.
We’ll cover how both lossy and lossless WebP compare to JPEGs and PNGs exported by a number of image encoders.
Converting Images To WebP (Excerpt)
This can be done in a myriad of ways, from something as simple as exporting from your preferred design program, by using Cloudinary and similar services, and even in Node.js-based build systems. Here, we’ll cover all avenues.
Using WebP Images
Because WebP isn’t supported in all browsers just yet, you’ll need to learn how to use it that sites and applications gracefully fall back to established formats when WebP support is lacking. Here, we’ll discuss the many ways you can use WebP responsibly, starting by detecting browser support in the Accept request header.
About The Author
Jeremy Wagner is a performance-obsessed front-end developer, author and speaker living and working in the frozen wastes of Saint Paul, Minnesota. He is also the author of Web Performance in Action, a web developer’s companion guide for creating fast websites. You can find him on Twitter @malchata, or read his blog of ramblings.
Here’s Why This eBook Is For You
The WebP Manual will get you ready for the new image format that is capable to significantly less data-intensive user experiences for a majority of your audience:
Learn how lossy and lossless WebP compare to JPEGs and PNGs exported by a number of image encoders.
Learn which services and plugins you can use to export or convert images to WebP with your preferred design tool or command line tool.
Learn how to can use WebP in production, and how to implement proper fallbacks for browsers that don’t support WebP just yet.
Learn how to use the full potential of the WebP format. It will substantially improve loading performance for many of your users, customers, and clients, and it will become one of your favorite tools for making websites as lean as possible.
You’re unhappy with your conversion rate. People just aren’t buying what you’re selling. The solution might lie in tripwire marketing. The term tripwire marketing might sound a little shady, like you’re trying to get one over on your customer. That’s not the case at all. Marketing and advertising experts have been using tripwire marketing for decades in one form or another, and it works just as well online as it does in brick-and-mortar stores. In fact, it’s even more effective because you can more easily stay in touch with the customer. What is tripwire marketing? And how does it work?…