New Editor Setting: Format on Save

I'd say in the last couple of years, configuring code editors to run a code formatter when you save the file has become a standard. Thanks in no small part to Prettier I'm sure. We use (and love) Prettier on our own codebase as well along with tools like Rubocop (which also can/does auto-formatting) to keep our code formatted as we work.

We're happy to announce we're making this feature available as you work on CodePen as well!

You can flip it on/off anytime in your global user settings

Everyone has these settings:

But that's just a default, you can turn it on/off at the Pen Settings level too

This means if you like this feature only on some Pens, you can leave the global setting off and flip it on for those Pens. Or turn the global default on and flip it off for Pens you'd prefer not to.

This is under Pen Settings > Behavior:

It works like this when it's on

You either hit Command (Mac) / Control (PC) + S, or click/tap the Save button itself:

That's mostly Prettier at work there (which we just switched to somewhat recently), but also stuff like js-beautify for HTML as the HTML formatting is a little more chill than what Prettier does to HTML.

You might notice the editor temporarily goes into a read-only mode while it's formatting. This is just so when the formatting is complete it doesn't wipe out any changes you might have made otherwise.

Autosave does not affect this. When Autosave kicks on (if you have it on), it will still save on a timer, but it will not trigger formatting as it does. That's so it won't catch you off guard when you're in the middle of coding!

There is a keyboard command too

Command (Mac) / Control (PC) + Shift + F

That will run the formatting in a single editor on command.

You might see a modal when you log in letting you know about this

Hey, chances are a lot higher you're going to see that than see this.

We think it's neat how you can flip on the setting right there in the modal. We had good luck with that when we released Private by Default, so it's a thing now.

The post New Editor Setting: Format on Save appeared first on CodePen Blog.

The International WordPress Community and WordCamps Amid COVID-19

With the rising numbers of people who have contracted COVID-19, a disease caused by SARS-CoV-2 (severe acute respiratory syndrome coronavirus 2), it is time for the WordPress community to begin evaluating what the remainder of 2020 may look like. It is not a time for panic. However, some serious discussions will need to happen and decisions made on an ongoing basis.

Last month, WordCamp Asia made the tough decision to cancel its inaugural event in Bangkok, Thailand. Given the spread of the coronavirus strain in the East Asian region and many unknowns at that point, it was a safe decision to protect our international community.

Wordfence spearheaded the effort to aid people with financial losses due to WordCamp Asia’s late cancellation. The company covered $10,000 of lost funds for attendees. Yoast and GoDaddy are equally splitting costs beyond the initial $10,000 through the same WordCamp Asia Cancellation Fund. To date, 117 applications have been verified and approved for a total of $19,860. There are still eight pending applications for an additional $1,409.

Mark Maunder, CEO of Defiant (the company behind Wordfence), seemed proud of how the community came together to make this happen. He said that people acted with integrity during the process and many often made sure to only ask for smaller amounts of money to cover their lost expenses.

Yesterday, Maunder authored a detailed post titled COVID-19 and WordPress Community Engagement in 2020. In it, he announced that his team would not be traveling globally to WordCamps until COVID-19 has run its course. He also urges organizers to cancel WordCamp Europe this summer, to cancel WordCamps globally for the time being, and for WordCamp US to be put on hold. Instead, the community can focus on doing remote events and providing an example to the world in how we can organize and collaborate online. By taking a proactive approach and dealing with the issue sooner rather than later, it can save organizers headaches down the road and save attendees money by canceling early.

“It is my experience that people react to bad situations too slowly,” wrote Maunder. “Whether it is a choking victim, a storm or a national emergency, there is the awkward pause that happens as life-as-usual transforms into a realization of reality requiring fast action. Often, that reality only sets in after the event.”

Maunder said he desired to take a data-driven approach to determine whether camps and conferences should cancel. It is not about raising panic or unnecessary alarm. He wants people to make sure they think about how we deal with this as a community and not in terms of our potential health risks as individuals. A healthy 30-year-old is at low risk of mortality, for example. However, that same healthy adult can transfer the virus to the elderly and immune-compromised people who are at higher risks. Bringing together large groups who are traveling internationally may help spread the virus because it de-localizes the problem. This is particularly true for larger WordCamps that have a global list of attendees.

Current WordCamp Updates and Cancellations

WordCamp Europe organizers announced earlier today that the annual event will continue as planned. The conference will take place on June 4-6 in Porto, Portugal. The team said they were in contact with the national health authority, DGS, in Portugal. They are monitoring the situation. Currently, there is at least one confirmed case of COVID-19 in Portugal, but the government has not shut down its borders. Those planning to attend WordCamp Europe should keep an eye on the camp’s Coronavirus Updates page. Plans could change.

Smaller, more regional WordCamps will want to keep a careful eye on what is going on locally. This means following local news sources and staying informed by local government officials.

WordCamp Geneva organizers have postponed their event, which was set for March 21. At the moment, they are planning to set it back about six months, pending an improvement in the COVID-19 situation. Otherwise, they will make the decision to cancel the event completely for the year. The announcement came after the Swiss government banned large-scale events with over 1,000 people. The organizers worried that such a ban would eventually extend to smaller events.

The WordCamp Retreat, held annually in Soltau, Germany, has also been canceled for 2020. The event was scheduled to run from April 30 through May 3. The organizers plan to revive the retreat in May 2021. Organizers said because of the unusual format in comparison to a normal WordCamp, the costs of waiting until later before deciding to cancel would have been financially irresponsible. The format of the retreat has higher costs associated with how it is run. February 29 was the last day to make a decision to cancel while breaking even financially.

Staying Informed

Aside from WordCamps, agencies and other companies with a physical location should prepare for having their employees do their work remotely. This means setting up channels for communication, if they are already not in place, for continuing their work efficiently. While we should all hope for the best outcome, preparedness is key for when things go awry.

The most important thing for the global WordPress community to do right now is to continue communicating and sharing data from official sources. Organizers, employers, and travelers will sometimes have to make tough calls. Safety is always more important than whether we can network in person.

The following are links to resources from the World Health Organization. Everyone should also keep track of national, state, and other local resources.

For Loops in JavaScript: Native, forEach, and For-of

In this article, we're going to walk through the many different ways to loop through arrays in JavaScript, from the native approach many will be familiar with, to more recent (and readable) methods introduced in ES6 and later. 

Native For-Loop

JavaScript
 




xxxxxxxxxx
1


1
let myArray = ["Hello,", "world!", "It's", "nice", "to", "meet", "you!"];
2

          
3
for(let i = 0; i < myArray.length; i++) {
4
    const currElem = myArray[i];
5
  
6
    console.log(`At index ${i}, our element is: ${currElem}`);
7
}



Considerations for Creating a Card Component

Here's a Card component in React:

const Card = props => {
  return(
    <div className="card">
      <h2>{props.title}</h2>
      <p>{props.content}</p>
    </div>
  )
}

It might be pretty useful! If you end up using this thing hundreds of times, now you have the ability to refactor a little bit of HTML across your app very easily. You already have that power in CSS because of the class name there, but now you have HTML control too. Feel it.

But wait. Maybe this is limiting... an <h2>? What if that really should have been an <h4> in some usages? What's the approach there? Maybe an API of sorts?

const Card = props => {
  return(
    <div className="card">
      {props.type === "big" && <h2>{props.title}</h2>}
      {props.type !== "big" && <h4>{props.title}</h4>}
      <p>{props.content}</p>
    </div>
  )
}

Or maybe we force a level to be passed in?

const Card = props => {
  const HeaderTag = `h${props.level}`;
  return(
    <div className="card">
      <HeaderTag>{props.title}</HeaderTag>
      <p>{props.content}</p>
    </div>
  )
}

Or maybe that header is its own component?

And a forced paragraph tag wrapper around that content? That's a little limiting, isn't it? Maybe that should be a <div> so that it could take arbitrary HTML inside it, like multiple paragraphs.

const Card = props => {
  return(
    <div className="card">
      <WhateverHeader>{props.title}</WhateverHeader>
      <div>{props.content}</div>
    </div>
  )
}

Actually, why even ask for content with props? It's probably easier to deal with a child component, especially if what is coming over is HTML.

const Card = props => {
  return(
    <div className="card">
      <WhateverHeader>{props.title}</WhateverHeader>
      {children}
    </div>
  )
}

There are more assumptions we could challenge too. Like card only for a class name... shouldn't that be more flexible?

const Card = props => {
  const classes = `card ${props.className}`;
  return(
    <div className={classes}>
      <WhateverHeader>{props.title}</WhateverHeader>
      {children}
    </div>
  )
}

I'm still forcing card there. We could drop that so that it isn't assumed, or build another aspect of the Card API providing a way to opt-out of it.

Even the <div> wrapper is presumptuous. Perhaps that tag name could be passed in so that you could make it into a <section> or <article> or whatever you want.

Maybe it's better to assume nothing actually, making our card like this:

const Card = () => {
  return(
    <>
      {children}
    </>
  )
}

That way anything you want to change, you have the freedom to change. At least then it's flexibility while being relaxed about it, rather than this kind of "flexibility":

<Card
  parentTag="article"
  headerLevel="3"
  headerTitle="My Card"
  contentWrapper="div"
  cardVariation="extra-large"
  contentContent=""
  this=""
  little=""
  piggy=""
  went=""
  to=""
  market=""
/>

That kind of extreme-API-zying just happens sometimes when you're grasping for control and flexibility at the same time.

A component model with no guidance can lead to over-componentization also, like perhaps:

const Card = props => {
  return(
    <CardWrapperTheme>
      <CardWrapper>
        <CardTitle />
        <CardContent />
        <CardFooter />
      </CardWrapper>
    </CardWrapperTheme>
  )
}

There might be perfectly good reasons to do that, or it might be the result of componentizing because it's "free" and just feels like that's how things are done in an architecture that supports it.

There is a balance. If a component is too strict, it runs the risk of that people won't use them because they don't give them what they need. And if they're too loose, people might not use them because they don't provide any value, and, even if they did use them, they don't offer any cohesiveness.

I don't have any answers here, I just find it fascinating.

The post Considerations for Creating a Card Component appeared first on CSS-Tricks.

Fuchsia OS: Google’s New Android?

Everything began in 2016 when Google started taking a shot at its ambitious working framework Google Fuchsia. As of 2017, Google didn't say a word about Fuchsia OS.

Since then, a lot of theories have been going on around this technique. It has received a mixed response from the smartphone industry. Some consider it a far-fetched, while some consider it the next big thing in the OS domain that can replace Android.

Top 10 Custom Software Development Methodologies

Custom software development has become a pressing need for many organizations. Earlier it was not a necessary call, but today, with technology finding its way into our lives, it has become an essential part of the overall strategy. Custom software development cannot happen overnight. It has to be planned with goals, objectives, budget and time span that you need to execute the project. After factoring in these aspects, a development methodology is selected.

The decision to decide on development methodology is incumbent on every single aspect of the project. Let us discuss some of the most popular methodologies and see for yourself which will go well with your project.

Geospatial Data Analysis in Angular

Immersive experience has tapped into data analysis with a dazzling array of visualization techniques. The evolution of visualization-based data analysis influences business and sets apart from the competition since it can help provide the desired user experience. Users prefer data storytelling and demand data visualization beyond reports and dashboards. IT teams add visualization features to enable and standardize data visualization as it is a powerful mode for displaying the metrics.

You may also like: What Data Analysis Tools Should I Learn to Start a Career as a Data Analyst?

Unfortunately, clip-path: path() is Still a No-Go

I was extremely excited when I first heard that clip-path: path() was coming to Firefox. Just imagine being able to easily code a breathing box like the one below with just one HTML element and very little CSS without needing SVG or a huge list of points inside the polygon function!

Chris was excited about the initial implementation, too.

How fun would this be:

Animated gif. Shows a square breathing in and out - its waistline smoothly contracts and then expands.
Breathing box.

I decided to give it a try. I went on CodePen, dropped a <div> in the HTML panel, gave it dimensions in viewport units so that it scales nicely, added a background so that I could see it. Then I went on MDN to check out some usage examples... and my fluffy cloud of a dream began to crash!

Note that clip-path: path() only works in Firefox 63-70 with the layout.css.clip-path-path.enabled flag set to true in about:config and in Firefox 71+ without needing to enable any flag. (Source: MDN.)

These were the examples I found:

path('M0 200L0 110A110 90 0 0 1 240 100L 200 340z')
path('M.5 1C.5 1 0 .7 0 .3A.25 .25 1 1 1 .5 .3 .25 .25 1 1 1 1 .3C1 .7 .5 1 .5 1Z')

What are those coordinates? The sad answer is pixel values! Those are used because the path() function takes an SVG <path> string as an argument which — like the value of the SVG d attribute on a <path> element — only contains one kind of coordinate value: unit-less pixels. In the SVG case, these pixels scale with the viewBox of the <svg> element but they don't scale at all inside the CSS path() function!

This means the element always gets clipped to the same fixed area if we have a responsive element with a path() value for the clip-path property. For example, consider a square .box whose edge length is 35vw. We clip it to a heart using the path() function:

clip-path: path('M256 203C150 309 150 309 44 203 15 174 15 126 44 97 73 68 121 68 150 97 179 68 227 68 256 97 285 126 285 174 256 203')

This heart shape stays the same size while the dimensions of our actual .box element changes with the viewport:

Animated gif. Shows how the heart clipped using a fixed pixel path() doesn't fit within the element's bounding rectangle when its viewport-depending size goes down at small screen sizes.
The issue with a fixed pixel path().

This is bad news here in 2020, where responsive design is the standard, not the exception. Save for the odd case where the element we want to clip actually has a fixed pixel size, the path() function is completely useless! We're still better off using an actual SVG today, or even a polygon() approximation value for clip-path. In short, path() is still in need of improvement, despite getting off the ground.

Amelia Bellamy-Royds has suggested two possibilities here:

Option 1: Allow calc() values/units inside path data. This would probably be done while extending SVG path syntax in general.

Option 2: Specify viewBox in clip-path declaration, scale path to fit.

I personally prefer the first option. The only advantage the second one offers over using SVG is the fact that we don't have to include an actual SVG. That said, including an actual SVG is always going to have better support.

The first option, however, could be a huge improvement over using SVG — at least enough of an improvement to justify using clip-path on an HTML element instead of including an SVG inside it. Let's consider the breathing box at the top of this post. Using SVG, we have the following markup:

<svg viewBox='-75 -50 150 100'>
  <path/>
</svg>

Note that the viewBox is set such that the 0,0 point is dead in the middle. This means we've got to make the coordinates of the top-left corner (i.e. first two viewBox values) equal to minus half the viewBox dimensions (i.e. the last two viewBox values).

In SCSS, we set the edge length ($l) of the initial square box as the smallest viewBox dimension (which is the smallest of the last two values). This is 100 in our case.

We start the path from the top-left corner of our square box. This means a move to (M) command to this point, with coordinates that are both equal to minus half the length of the edge.

We then go down to the bottom-left corner. This requires drawing a vertical line with a length that equals an edge length ($l) and goes down, in the positive direction of the y axis. So, we'll use the v command.

Next, we go to the bottom-right corner. We'll draw a horizontal line with a length that equals an edge length ($l) and goes right, in the positive direction of the x axis. We'll use the h command to make that happen.

Going to the top-right corner means drawing another vertical line of with a length equal to the edge length ($l), so we will use the v command again — only this time, the difference is the fact that we go in the opposite direction of the y axis, meaning we use the same coordinates, but with a minus sign.

Putting it all together, we have the SCSS that allows us to create the initial square box:

.box {
  d: path('M#{-.5*$l},#{-.5*$l} v#{$l} h#{$l} v#{-$l}');
  fill: darkorange
}

The generated CSS (where $l is replaced with 100) looks like this:

.box {
  d: path('M-50,-50 v100 h100 v-100');
  fill: darkorange;
}

The result can be seen in the interactive demo below where hovering a part of the path data highlights the corresponding part in the resulting SVG and the other way around:

See the Pen by thebabydino (@thebabydino) on CodePen.

However, if we want the lateral edges to breathe, we can't use straight lines. Let's replace those with quadratic Bézier (q) ones. The end point remains the same, which is one edge length down along the same vertical line. We travel by 0,#{$l} to get there.

But what about the control point we need to specify before that? We place the point to be vertically midway between the start and end points, meaning we go down to it by half of we travel to get to the end point.

And let's say that, horizontally, we place it by a quarter of an edge length to the side in one direction or the other. If we want the lines to protrude to widen the box or squeeze them in to narrow it, we need to do something like this:

d: path('M#{-.5*$l},#{-.5*$l} 
         q#{-.25*$l},#{.5*$l} 0,#{$l} 
         h#{$l} 
         v#{-$l}'); /* swollen box */

d: path('M#{-.5*$l},#{-.5*$l} 
         q#{.25*$l},#{.5*$l} 0,#{$l} 
         h#{$l} 
         v#{-$l}'); /* squished box */

This compiles to the following CSS:

d: path('M-50,-50 
         q-25,50 0,100 
         h100 
         v-100'); /* swollen box */

d: path('M-50,-50 
         q25,50 0,100 
         h100 
         v-100'); /* squished box */

The interactive demo below shows how this path works. You can hover over path data components to see them highlighted on the SVG graphic. You can also toggle between the swollen and squished versions.

See the Pen by thebabydino (@thebabydino) on CodePen.

This is only the left edge. We need to do the same thing for the right edge as well. The difference here is that we're going from the bottom-right corner to the top-right corner instead, which is up (in the negative direction of the y axis). We'll place the control point outside the box to get the wide ox effect, which also means placing it to the right of its endpoints (in the positive direction of the x axis). Meanwhile, we'll place the control point inside to get the narrow box effect, which means placing it to the left of its endpoints (in the negative direction of the x axis).

d: path('M#{-.5*$l},#{-.5*$l} 
         q#{-.25*$l},#{.5*$l} 0,#{$l} 
         h#{$l} 
         q#{.25*$l},#{-.5*$l} 0,#{-$l}'); /* swollen box */

d: path('M#{-.5*$l},#{-.5*$l} 
         q#{.25*$l},#{.5*$l} 0,#{$l} 
         h#{$l} 
         q#{-.25*$l},#{-.5*$l} 0,#{-$l}'); /* squished box */

The above SCSS generates the CSS below:

d: path('M-50,-50 
         q-25,50 0,100 
         h100 
         q25,-50 0,100'); /* swollen box */

d: path('M-50,-50 
         q25,50 0,100 
         h100 
         q-25,-50 0,-100'); /* squished box */

See the Pen by thebabydino (@thebabydino) on CodePen.

In order to get the breathing effect, we animate between the swollen state and the squished state:

.box {
  d: path('M#{-.5*$l},#{-.5*$l} 
           q#{-.25*$l},#{.5*$l} 0,#{$l} 
           h#{$l} 
           q#{.25*$l},#{-.5*$l} 0,#{-$l}'); /* swollen box */
  animation: breathe .5s ease-in-out infinite alternate
}

@keyframes breathe {
  to {
    d: path('M#{-.5*$l},#{-.5*$l} 
             q#{.25*$l},#{.5*$l} 0,#{$l} 
             h#{$l} 
             q#{-.25*$l},#{-.5*$l} 0,#{-$l}'); /* squished box */
  }
}

Since the only thing that differs between the two states is the sign of the horizontal difference to the control points (the sign of the first number after the quadratic Bézier curve q command), we can simplify things with a mixin:

@mixin pdata($s: 1) {
  d: path('M#{-.5*$l},#{-.5*$l} 
           q#{-.25*$s*$l},#{.5*$l} 0,#{$l} 
           h#{$l} 
           q#{.25*$s*$l},#{-.5*$l} 0,#{-$l}')
}

.box {
  @include pdata();
  animation: breathe .5s ease-in-out infinite alternate
}

@keyframes breathe { to { @include pdata(-1) } }

This is pretty much what I'm doing for the actual breathing box demo, though the motion is slightly more discreet. Still, this does absolutely nothing for the generated CSS — we still have two long, ugly and almost identical paths in the compiled code.

However, if we were able to use a <div>, clipped with a clip-path: path() that supported all sorts of values, including calc() values inside, then we could make the sign a custom property --sgn, which we could then animate between -1 and 1 with the help of Houdini.

div.box {
  width: 40vmin; height: 20vmin;
  background: darkorange;
  --sgn: 1;
  clip-path: path(M 25%,0%
                  q calc(var(--sgn)*-25%),50% 0,100%
                  h 50%
                  q calc(var(--sgn)*25%),-50% 0,-100%);
  animation: breathe .5s ease-in-out infinite alternate
}

@keyframes breathe { to { --sgn: -1 } }

Being able to do this would make a whole world of difference. Our element would scale nicely with the viewport and so would the breathing box we clip out of it. And, most importantly, we wouldn't need to repeat this clipping path in order to get the two different versions of it (the swollen one and the squished one), because using the sign custom property (--sgn) inside a calc() value would do the trick. As it is right now, however, clip-path: path() is pretty much useless.

The post Unfortunately, clip-path: path() is Still a No-Go appeared first on CSS-Tricks.

Selectors Explained

Have you ever found yourself either writing a CSS selector that winds up looking confusing as heck, or seen one while reading through someone's code? That happened to me the other day.

Here's what I wrote:

.site-footer__nav a:hover > svg ellipse:first-child { }

At the end of it, I honestly couldn't even explain what it does to myself. LOL, that probably means there was a better way to write it.

But Hugo Giraudel has this handy new tool that will explain any selector you throw at it.

Here's how it explained mine:

An <ellipse> element provided it is the first child of its parent somewhere
… within a <svg> element
… itself directly within an <a> element provided it is hovered
… itself somewhere
… within an element with class site-footer__nav.

Bravo! It even spits out the specificity of the selector to boot. 👏

Direct Link to ArticlePermalink

The post Selectors Explained appeared first on CSS-Tricks.

20 Amazing Pure CSS Animated Buttons

If you want to give your website a little extra flair, you’ll definitely want to investigate and utilize CSS animated buttons. These bits of code add a layer of interactivity to your website that most site visitors will appreciate. Plus, they can be used to add a sense of dynamics and further help to solidify your brand.

If you’re not sure where to start in getting these buttons for your site, however, we’ve taken the guesswork out of the process for you. What follows is a list of 20 different CSS animated buttons that you can add to your site via some relatively simple CSS. It doesn’t get much easier!

The UX Designer Toolbox

Unlimited Downloads: 500,000+ Wireframe & UX Templates, UI Kits & Design Assets
Starting at only $16.50 per month!


1. Stylish Animated CSS Buttons for Bloggers

See the Pen Stylish Animated CSS Buttons For Blogger. by Prio-Soft™ (@priosoft) on CodePen.default

 

This set of stylish animated CSS buttons are ideal for use by bloggers. They offer a wide range of hover effects from swiping color across a button from left to right (and vice versa), from top to bottom, that highlights the outline of the button, and more.

2. Animated CSS Buttons

See the Pen animated-css-buttons by Naved khan (@Navedkhan012) on CodePen.default

 

This set of animated CSS buttons have a simplicity to them that makes them highly usable in a wide variety of contexts. On hover, these buttons fill with color at angles, employ swipe effects, pattern fills, and more.

3. More Animated CSS Buttons

See the Pen Animated CSS Buttons by an (@annguyn) on CodePen.default

 

This set of CSS buttons are very simple but that’s precisely what makes them appeal. If you want to add just a tad of interactivity to your site, these are a safe bet.

4. CSS3 Buttons

See the Pen css 3 buttons by Oleg Semenov (@wemonsh) on CodePen.default

 

Now these CSS3 buttons offer cool transition effects. Some fill with color upon hover but others develop a drop shadow effect that makes the buttons appear to lift off the screen.

5. Simple CSS Buttons Animation

See the Pen Simple CSS buttons animation by Michael Domanych (@mhouse) on CodePen.default

 

As the title of this set of buttons would suggest, these CSS buttons are simple and straightforward in their design. They offer slide-in color from various directions as well as filling from the center out.

6. CSS + SVG Button Animation

See the Pen CSS + SVG Button Animation by Clément (@clmntclmnt) on CodePen.default

 

Here’s a single animated button but its effect is undeniably compelling. Upon hover, this button fills with color from the sides to the middle then a contrasting color outline appears around the button.

7. Animation with Cubic Bezier

See the Pen animation with cubic bezier by Franca (@franca_) on CodePen.default

 

This fun button would add real style to any website. When you hover over the button, the text within it changes color.

8. Pure CSS Button

See the Pen Pure CSS Button (animation with clip-path) by Marco Antônio (@thismarcoantonio) on CodePen.default

 

This button is a bit different than the rest of this list. It has a clip path that makes it so when you hover over the button text, a circle animation slides across an arrow, transforming the pointed end into a dot.

9. Blobs Button

See the Pen Blobs button by Hilary (@hilwat) on CodePen.default

 

As its name would suggest, the Blobs Button fills via colorful blobs upon hover. This is a great choice for those looking to add a touch of whimsy or fun to their websites.

10. Simple CSS Button Hover Effects

See the Pen Simple CSS Button Hover Effects by Natalia  Reshetnikova (@natalia-reshetnikova) on CodePen.default

 

Here’s another set of rather understated animated buttons that still manage to make a real impact. Some of the effects include the button’s text spreading out, The button itself splitting into an X shape, and color shifts.

11. CSS Button with Hover Effect

See the Pen CSS Button With Hover Effect by Raj Kamal Chenumalla (@avvign) on CodePen.default

 

Here’s another button that offers a super straightforward design. Upon hover, it develops an aura that quickly disappears. Subtle, yet effective.

12. 100 Days CSS Button N 045

See the Pen 100 days css Button N° 045 by Vitor Siqueira (@vitor-siqueira) on CodePen.default

 

This simple button has an effect where the outline of the button intensifies in color and chases its border when you hover over it.

13. Pure CSS Buttons

See the Pen Pure CSS Buttons by Ishaan Saxena (@ishaansaxena) on CodePen.default

 

Here’s another set of super simple CSS buttons. They fill with color from all directions upon hover and can be used as icons as well.

14. Auto Width CSS Button Flip

See the Pen Auto Width  Css Button Flip by Alex Moore (@MoorLex) on CodePen.default

 

What a fun option! When you hover over this animated button it appears to tip forward, revealing different text on the “back” of the button.

15. Collection of Button Hover Effects

See the Pen Collection of Button Hover Effects by David Conner (@davidicus) on CodePen.default

 

Here’s another set of animated CSS buttons that use fun hover effects to make a statement. Outline effects, fills, and color shifts make up the majority of the effects used here.

16. Pure CSS Button with Ring Indicator

See the Pen Pure CSS Button with Ring Indicator by Cole McCombs (@mccombsc) on CodePen.default

 

If you’re wanting to draw attention to a call-to-action or something like that, this button might be the perfect choice. It constantly emanates a ring out from its center, drawing the eye to it. Then, upon hover, the button is highlighted and lifts slightly.

17. CSS3 Button Hover Effects with FontAwesome

See the Pen CSS3 Button Hover Effects with FontAwesome by foxeisen (@foxeisen) on CodePen.default

 

This set of buttons use hover effects in conjunction with FontAwesome for some timeless design options. Hovering over these buttons reveal an arrow instead of text, a textual shift to accommodate an arrow on the button, and more.

18. CSS3 3D Flip Button

See the Pen CSS3 3d flip button by Sean Michael (@seansean11) on CodePen.default

 

Unlike all the other buttons on this list, the CSS3 3D Flip Button displays an effect when you click on it. Once you click, the button rolls up to reveal new text and icons. This is great way to indicate a form has been submitted, for instance.

19. Button Fun

See the Pen Button Fun by Jack Cuthbert (@JackCuthbert) on CodePen.default

 

Here’s another great button option that would appeal to those looking for a more understated look. When you hover over these buttons, the text and outline changes color with a cool aura effect.

20. Button Shine Effect

See the Pen Button Shine Effect by Dan Mensinger (@dmensinger) on CodePen.default

 

The last animated CSS button on our list is this Button Shine Effect. Upon hover, the button changes color and appears to shine as though a light has been passed over its surface. It’s simple and effective, the perfect level of interactivity to spark interest in your website.

Give These CSS Animated Buttons a Try

So, what have we learned here? You can add interactivity to your website without being an expert developer. And this collection of CSS animated buttons make it easy to add a little something extra to your site’s design. Whether you want to punch up a call-to-action or make your navigation more fun, give these buttons a try and see what works best for your site. For more CSS button tips and tutorials, check out our other articles here.

Ensuring SQL Server High Availability in the Cloud

Theoretically, the cloud seems tailor-made for ensuring high availability (HA) and disaster recovery (DR) solutions in mission critical SQL Server deployments. Azure, AWS, and Google have distributed, state-of-the-art data centers throughout the world. They offer a variety of SLAs that can guarantee virtual machine (VM) availability levels of 99.95% and higher.

But deploying SQL Server for HA or DR has always posed a challenge that goes beyond geographic dispersion of data centers and deep levels of hardware redundancy. Configuring your SQL Server for HA or DR involves building a Windows Server Failover Cluster (WSFC) that ensures not only the availability of different machines running SQL Server itself but also — and most importantly — the availability of storage holding the data in which SQL Server is interacting.

Inspired Design Decisions: Neville Brody Design Cannot Remain Neutral

Inspired Design Decisions: Neville Brody Design Cannot Remain Neutral

Inspired Design Decisions: Neville Brody Design Cannot Remain Neutral

Andrew Clarke

Although I was born in North West England, I grew up in Corby, a steel working town in the middle of the country. From the 1930s, Corby had grown to rely on steel production, with working-class families — a large number of them from Scotland — flocking to the area. During the Second World War, burning oil to produce thick smoke prevented all but a few German bombs, but when I was in my teens, a different toxic cloud, Thatcherism, hung over Corby as it did many industrial and manufacturing centres across the UK.

Corby had become part of the nationalised British Steel Corporation during the 1960s, but within twenty years, the Conservative government announced the closure of the Corby plant. This lead to 11,000 job losses and an unemployment rate in the town of over 30%.

As a teenager growing up in Corby in the early 1980s, my prospects were as grim as many thousands of others in the town. Music was one form of distraction and clubs and pubs around Corby had a thriving local music scene. Bands with names like Bandits At 7 O’Clock, The Laughing Mothers, and Play The Joker, were inspired by the dark themes of post-punk, rockabilly and classic rock.

Music wasn’t only for escapism, it was also a way to express political opinions and support the causes we cared about. As part of the Corby Music Collective, my band, The Inline, played gigs in support of the anti-apartheid movement and even supported Billy Bragg on his first national tour in support of striking miners. I still have the backstage pass which Billy signed for me.

Local bands designed their own publicity and the mostly two-colour artwork was edgy and unpolished. Local screen-printing workshops offered affordable flyers and posters. Music magazines were popular too. Not mainstream publications like Melody Maker or teen titles like titles, but titles like Sounds, which covered counter-culture, and of course The Face. I knew there was something special about it, although at the time I didn’t know what an art director did or who Neville Brody was.

The Face became a pop culture mirror to the political and social turmoil in Britain at that time. Its unconventional and thought-provoking designs and Brody’s subsequent work redefined the British music press from the 1980s onwards and influenced a generation of designers. Even twenty-five years after he created them, Brody’s pages from The Face magazine are still remarkable designs. I’m still inspired by them every day and in this issue, I’m going to explain some of the ways how.

Previously On “Inspired Design Decisions”

  1. Inspired Design Decisions: Avaunt Magazine
  2. Inspired Design Decisions: Pressing Matters
  3. Inspired Design Decisions: Ernest Journal
  4. Inspired Design Decisions: Alexey Brodovitch
  5. Inspired Design Decisions: Bea Feitler
Music magazines from 1980 including The Face (far right)
Music magazines from 1980 including The Face (far right). (Large preview)

Inspired by Inspired by Neville Brody

British punk was a reaction to mass unemployment and a reflection of the social unrest in 1970s Thatcherite Britain. Punk rejected anything it considered self-indulgent, and its DIY approach stripped music back to basics.

In 1977 — at the height of punk’s influence on British culture — Brody began studying graphics at The London College of Printing, where he soon found the environment frustrating and out of step with what was happening around them. Tutors at the LCP emphasised commercial applications for graphic design and Brody’s experimental work was condemned by them as “uncommercial.”

But Brody’s fast-paced, DIY approach to approach to design and especially his use of homemade typography were perfectly suited to the band posters he made while still at the LCP. After leaving, Brody designed record sleeves for Rocking Russian before moving to Stiff Records, and ultimately to The Face. The Face was a culture, fashion, and music magazine published in Britain until 2004 and Brody worked as its art director until 1986.

The Face was a living laboratory where I could experiment and have it published. Our golden rule was to question everything. If a page element existed just as taste or style, it could be abandoned. Page numbers could be letters or shapes increasing in size. We could start the headline on the page before. We had disasters and near misses every issue. We had two weeks to art direct everything, then a week to lay it out. It was pre-computer so everything was traced by hand. […] It certainly wasn’t a nine-to-five job. You had to be obsessed to make it work.

— Neville Brody
Jungle Fever: The Art of Jean-Paul Goude. The Face 1982. Art direction by Neville Brody. In much of Brody’s work, structure is the main feature of the design.
Jungle Fever: The Art of Jean-Paul Goude. The Face 1982. Art direction by Neville Brody. In much of Brody’s work, structure is the main feature of the design. (Large preview)

Good typography is often described in terms of rules, but Brody wasn’t interested in rules, so he skipped typography classes at the LCP. Not knowing the conventional rules of typography meant that Brody wasn’t limited by them. Instead, Brody studied typography he saw around him, from the Dadaism movement, Futurism, and the work of Alexander Rodchenko, whom I introduced in a previous issue.

Brody saw typography as a medium for commenting ideas and so should be expressive and entertaining. Widely spaced letters became a familiar part of Brody’s designs for The Face. He used this extra whitespace for its aesthetic, and to emphasise the horizontal, vertical, and sometimes diagonal direction of lines of type. His wide letter-spacing also slowed down the reading experience and created spaces for people to pause and consider the content.

But despite Brody’s lack of traditional typography training, his priority was still that people should be able to easily read the magazine. With that in mind, he worked closely with the editorial team at The Face.

The Face maintained punk’s rebellious attitude, but its original aesthetic wasn’t just superficial. With The Face, Brody questioned the structure of a magazine and how people experience it. I find plenty of parallels between how he explored the multi-page experience of reading a magazine and how people use the web.

The Werk Ethic. The Face 1982. Art direction by Neville Brody. This spread is reminiscent of Constructivism in the arrangement of images and text.
The Werk Ethic. The Face 1982. Art direction by Neville Brody. This spread is reminiscent of Constructivism in the arrangement of images and text. (Large preview)

In The Face, bleeding images and type off the edges of a page does more than making the magazine look unique. It suggests that there’s more to see outside the visible page and that what someone sees is part of something bigger.

The layout grid throughout The Face uses just two or three columns, but Brody’s execution shows just how flexible even the simplest grids can be when combined with imagination. The Face demonstrates how a system for design is the structure on which you start building a design. It should support a design, not define, nor dictate the end result.

On the web, we’re told to not make someone look more than once, to not make them think. But, one of the reasons I find Brody’s work so fascinating is it makes people look twice. His spread designs for The Face were often self-contained and encouraged people to linger on them rather than quickly turn the page. While you might think this runs counter to the principles of user experience design, in reality, it can be a factor in making your designs more memorable because people spend more time considering them.

The Resurrection of Chad. The Face 1984. Art direction by Neville Brody. This design introduced a hand-drawn typeface which was frequently used in the magazine from then on.
The Resurrection of Chad. The Face 1984. Art direction by Neville Brody. This design introduced a hand-drawn typeface which was frequently used in the magazine from then on. (Large preview)

This rule-breaking attitude needn’t be at the expense of usability. Brody’s designs for The Face use a grid, which provides structure to a page and continuity throughout the magazine. They also include features which guide someone through an article, from where to start reading, to knowing they’ve reached the end. Drop-caps are a traditional device for helping someone know where to start, but Brody became obsessed with finding alternatives, including graphic symbols, alternative type treatments, and whitespace. As Brody explained to Jon Wozencroft in 1987, “Once you have broken down the rules, literally anything is possible.”

For a lot of designers, The Face became the perfect graphic phrase-book, but its success, I hope, is also an indication that you can go against the grain and make it work commercially.

— Neville Brody

Brody wanted his work to demonstrate that breaking with traditional approaches to design is possible, even when what you’re designing is commercial. He didn’t want people to merely imitate his designs or use them to create new rules or traditions. I feel the same way about exploring ideas from print and other media and applying them to the web without questioning what we’re aiming to achieve and why we’re doing it.

After five years, Brody left The Face in 1986 and became one of Britain’s most influential and prolific designers. In the 1990s, Brody co-founded the FUSE project with Jon Wozencroft, and their groundbreaking magazine ran for twenty issues. He also co-founded FontFont, the typeface library, alongside Erik Spiekermann. In 2018, Brody stepped down from his position as Dean of the School of Communication at the Royal College of Art.

Jon Wozencroft — Brody’s partner at FUSE — published two volumes of ‘The Graphic Language of Neville Brody’ in 1988 and 1994. You can still find copies available on eBay. ‘The Story of The Face: The Magazine that Changed Culture’ by Paul Gorman is more readily available, as is a compendium of all twenty issues of FUSE. They’ll all make fabulous additions to your graphic design library.

Blends add depth and richness

For my first Brody-inspired design, the main content contrasts with a colourful and chaotic background image. I need only two structural elements to implement this energetic design; a header which contains the iconic Ford logo, a headline, and the tagline from a 1970s Capri advertisement. The main content includes an SVG profile of the Capri which sits on top of my running text:

<header>
<img src="logo.svg" alt="Ford">
<h1>Capri</h1>
<p>You might get wolf-whistles from the car next door</p>
</header>

<main>
<p><svg>…</p>
</main>
Left: Electro. The Face 1984. Right: For this main headline I used FF Blur Pro Medium, a typeface designed by Brody in 1992.
Left: Electro. The Face 1984. Right: For this main headline I used FF Blur Pro Medium, a typeface designed by Brody in 1992. (Large preview)

Using an inline SVG for this graphic image means one fewer requests to a server, and provides the ability to change the Capri’s paint colour to match any colour background. I start by adding background and foreground colours to the body of this page. Setting its minimum height ensures this background will fill the full height of the page at every screen size:

body {
padding: 0 1rem;
min-height: 100vh;
background-color: #ba0e37;
color: #fff; }

The Ford logo may be a classic, but I don’t want it to dominate this page when seen on small screens. I limit its maximum width to one-third of any viewport. This selector targets an image where “logo” occurs somewhere in an image’s source attribute:

[src*="logo"] {
max-width: 33vw; }

I add a double shadow to ensure my heavy headline and tagline spring out from the page. While the first shadow uses positive X and Y values, the second uses negative values. When combined, these shadows spread all around my text:

h1,
h1 + p {
margin-bottom: 0;
font-weight: 900;
text-shadow:
4px 4px 2px rgba(0,0,0,.35), 
-4px -4px 2px rgba(0,0,0,.35); }

h1 {
font-size: 3.4rem; }

h1 + p {
font-size: 1.802rem; }

My design should raise someone’s blood pressure as much as driving a Capri, so I add an adrenaline-filled background image which covers the entire page:

body {
background-image: url(body.png);
background-size: cover; }

This image may be monochrome, but adding a background-blend-mode property with a value of multiply crams this page with colour:

body {
background-blend-mode: multiply; }

Introducing background-blend-mode

Blend modes were proposed initially by the Adobe Web Platform team. They allow web designers the same control over blending colours that have been a feature of graphics software like Adobe Photoshop for years. These modes determine how two elements or more elements combine with each other.

The CSS Compositing and Blending module includes three properties; background-blend-mode, mix-blend-mode, and isolation. To implement this design, I use background-blend-mode which allows blending an element’s background colours and images:

body {
background-color: #ba0e37;
background-image: url(body.png);
background-blend-mode: multiply; }

There are fifteen background-blend-mode options; color, color-burn, color-dodge, darken, difference, exclusion, hard-light, hue, lighten, luminosity, overlay, saturation, soft-light, and screen.

Blend modes can be used to blend a background colour with a single background image, or when an element has more than background image, they can be applied differently to each which can add depth to a design. This background-blend-mode applies to all background images:

body {
background-image: url(body-1.png), url(body-2.png);
background-blend-mode: multiply; }

Whereas, to blend these two images differently, I apply two background-blend-mode values, making sure to list them in the same order as my images:

body {
background-image: url(body-1.png), url(body-2.png);
background-blend-mode: screen, multiply; }

CSS blend modes don’t merely save time on trips to an image editor, they’re also a fabulous way to add depth and texture to a design which can be refreshing when the majority of websites are flat and two-dimensional.

Almost universally, contemporary browsers support the same compositing tools we’ve used in graphic design and photo editing software for years.
Almost universally, contemporary browsers support the same compositing tools we’ve used in graphic design and photo editing software for years. (Large preview)

To implement the rest of this small screen design. I add a background image of a spark plug silhouette which fills the main element which contains my running text:

main {
background-image: url(main-1.svg);
background-position: 0 0;
background-repeat: no-repeat;
background-size: 100%; }

Then, I use a mixture of rem-based and viewport width padding to solidify that content into a narrow column:

main p {
padding: 8rem 20vw 6rem; }

Text which is justified to both left and right edges often creates unsightly rivers of white space between words. These gaps can interrupt the reading experience. It’s for this reason, justified text is rarely used online.

Hyphenation wraps words onto multiple lines and splits a line’s last word with a hyphen. There are three values for hyphenation in CSS:

  • none: Words aren’t broken, so longer words will flow onto a new line, sometimes leaving an unattractive gap at the end of a line.
  • manual: Words are broken when either a hard hyphen or an invisible soft hyphen (­) inside them suggests an opportunity.
  • auto: A browser inserts hyphens according to its own rules and the language used. Browsers vary in how they apply these rules.

Sadly, not all browsers support hyphenation, so to avoid unsightly rivers within the text, I should only apply the hyphens property to supporting browsers. For this, I use a feature query.

Introducing feature queries

You’ll probably already know all about @media queries and use them to adjust styles across different screen sizes. While @media queries test whether a device is a printer or screen, and tests for height, width, or orientation, the @supports at-rule tests browsers’ features.

A basic feature query tests both a property and a value. For example, this query tests whether a browser supports the column-count property and a value of 2 before applying them to a main element:

@supports (column-count: 2) {
main { column-count: 2; }
}

Browsers which don’t support column-count will ignore this style. Occasionally, I may need to also style an element when the browser doesn’t support a feature, can apply those styles using a :not operator:

@supports not (column-count: 2) {
main { padding: 0 3rem; }
}

I might also need to test support for two features at the same time using an and operator. Styles will apply to this main element when a browser supports both column-count and hyphens:

@supports (column-count: 2) and (hyphens: auto) {
main p { hyphens: auto; }
}

Otherwise, I might test whether a browser supports one or more in a series of features using the or operator:

@supports (column-count: 2) or (hyphens: auto) {
main p { hyphens: auto; }
}

The feature you test needn’t be the same as the style you want to apply. For example, in this design, I only want to justify my main paragraphs if a browser supports hyphenation:

@supports (hyphens: auto) {

.mk1 main p {
hyphens: auto;
text-align: justify;
text-align-last: left; }
}

For larger screens, I want the main content placed on the right, so I apply a symmetrical two-column grid with a 5vw gap between columns:

@media screen and (min-width : 64em) {

body {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 5vw; }
}

As the visual order of the header and main is the same as the document flow, there’s no need for me to place those elements on my grid.

I remove the limit on the Ford logo’s maximum width, then apply a second background image to the main. I use two different sets of background-position values to offset this white spark plug picture:

[src*="logo"] {
max-width: none; }

main {
min-height: auto;
background-image: url(main-1.svg), url(main-2.svg);
background-size: cover;
background-position: 0 4rem, 5vw 6rem;  }

Finally, I adjust the padding on my main paragraphs to accommodate the width of that second background image:

main p {
padding: 18rem 12vw 0; }
This first Brody-inspired design blends multiple background images to create potentially limitless variations.
This first Brody-inspired design blends multiple background images to create potentially limitless variations. (Large preview)

Theming using CSS Custom Properties

Previously only pre-processing tools like LESS and Sass enabled developers to use variables in stylesheets, but now Custom Properties have brought variables natively to CSS. CSS Custom Properties are a fabulous new feature and have widespread support in contemporary browsers.

To write a custom property, simply add two dashes to the start of a style rule:

--color-text-default : #272732;

Hyphens or underscores are allowed in property names, but not spaces. Property names are also case-sensitive, so –color-text-default and –Color_Text_Default are two distinct properties.

To use a custom property in a stylesheet, var() tells a browser to retrieve the value of a property. Here, a browser retrieves the dark colour from the –color-text-default variable and applies it to the body element:

body {
color : var(--color-text-default); }

CSS Custom Properties are fabulous tools for theming, so to change the body background colour and the fill colour of my SVG Capri, I apply a shared custom property:

--theme: #ba0e37; }

body {
background-color: var(--theme); }

svg path {
fill: var(--theme); }

Vertical text for impact

This very different design shares much of the same HTML, but has an altogether different look and feel. I use a header which contains a heading, a Ford logo, and the large brake disk image:

<header>
<div>
<img src="logo.svg" alt="Ford">
<img src="brake.svg" alt="Brake disk">
</div>

<h1>Ford Capri <spanvMK1</span></h1>
</header>
Left: New Order. The Face 1984. Art direction by Neville Brody. Right: Multiple background images splash across my design.
Left: New Order. The Face 1984. Art direction by Neville Brody. Right: Multiple background images splash across my design. (Large preview)

The main element includes a headline and a division which contains my running text:

<main>
<h2><span>Get wolf-whistles</span> from the car next door</h2>

<p>…</p>

<div>
<p>…</p>
<p>…</p>
<p>…</p>
</div>
</main>

Background and foreground colours are the starting point for implementing this design:

body {
padding: 1rem;
background-color: #fff;
color: #272732; }

I then add two abstract background images, placing the first in the top-left of my body element, the second in the bottom-right. Both background images will be contained within the body while preserving their aspect ratio:

body {
background-image: url(body-1.png), url(body-2.png);
background-position: 0 0, 100% 100%;
background-repeat: no-repeat;
background-size: contain; }
Before implementing any design, I make a simple storyboard to demonstrate how my elements will flow across a selection of screen sizes.
Before implementing any design, I make a simple storyboard to demonstrate how my elements will flow across a selection of screen sizes. (Large preview)

My design includes a variety of typography treatments, including columns, drop-caps, and vertical text. I start by super-sizing the light grey main headline, and setting it uppercase. Using a span element within this headline allows me to change that part to blue:

h1 {
font-size: 3.4rem;
line-height: 1.2;
text-transform: uppercase; 
color: #dedddd; }

h1 span {
color: #2c5f9d; }

I apply the same text-transform to the second-level headline, then turn the paragraph which immediately follows it into a standfirst by adding two thick borders:

h2 {
font-size: 1.424rem;
line-height: 1.2;
text-transform: uppercase; }

h2 + p {
padding: 1rem 0;
border-top: 10px solid #e9e9e9;
border-bottom: 10px solid #e9e9e9;
font-size: 0.889rem;
font-weight: 600;
text-transform: uppercase; }

Although paragraph indentation is a common print typography technique, paragraph spacing is more popular on the web. Because I want to give this design an editorial feel, I remove the margins from paragraphs in my main, then indent every following paragraph by 1em. By using a text-based unit, this space will stay in proportion with the size of my text:

main div > p {
margin: 0;
font-family: 'Vollkorn', serif;
font-style: italic; }

main div > p + p {
text-indent: 1em; }

Drop caps add personality to a design, but are also an obvious pointer to where someone should start reading. Implementing drop caps online previously involved a mixture of font-size, line-height, and margin styles, but now we can use the initial-letter property instead.

Initial letter reduces styling to a single property, and a value which defines the number of line heights the letter occupies. Initial letter automatically adjusts the font size to span this number of lines.

I want to apply initial-letter to the first letter of the first paragraph in my main element. Not all browsers support initial-letter, so to avoid non-supporting browsers applying any styles relating to my drop cap, I use a feature query. Because Apple’s Safari requires a vendor specific prefix, that query includes both prefixed and unprefixed properties and an or argument:

@supports (initial-letter: 1) or (-webkit-initial-letter: 1) {

main div > p:first-of-type::first-letter {
margin: 0 .5rem;
font-family: Arial, Helvetica, sans-serif;
-webkit-initial-letter: 2;
initial-letter: 2;
color: #2C5F9D; }
}

A long-standing Safari bug renders an initial letter using system fonts instead of web fonts, so choose a system font which looks most similar to your intended drop cap style.

For larger screens, I apply a symmetrical two-column grid to the body and reduce the size of my two background images to 55%. Because the visual order of this design again matches the order of my HTML, I don’t need to place my header and main elements explicitly:

@media screen and (min-width : 64em) {

body {
display: grid;
grid-template-columns: 1fr 1fr;
background-size: 55%; }
}
Left: The margin around this header acts as a boundary which stops the eye moving beyond it. Right: Allowing that element to bleed off the top and left edges implies there’s more to see outside the viewport.
Left: The margin around this header acts as a boundary which stops the eye moving beyond it. Right: Allowing that element to bleed off the top and left edges implies there’s more to see outside the viewport. (Large preview)

One of the most obvious aspects of this design is the large vertical headline in the centre of the page. Vertical text elements are common in magazines, but I rarely see them on the web, except in Chinese, Japanese, Korean, and other scripts, which use vertical writing modes.

Before implementing my vertical headline, I make space for it by applying grid properties to my header. The second column is just wide enough to take my vertical headline, while the first column occupies all remaining space:

header {
display: grid;
grid-template-columns: 1fr 6rem;
padding: 1rem 0 1rem 2rem; }

To develop my vertical headline, I need do nothing more than switch its default writing mode to vertical (right–left:)

h1 {
writing-mode: vertical-lr; }

My headline fits in the centre of this page, and the reading direction starts at the top. To make it read bottom-up, I can spin it around by 180 degrees and justify it right, so it starts at the top of the column:

h1 {
text-align: right; 
transform: rotate(180deg); }

Text orientation

Using transform:rotate(); and text-align:right; to change an element’s reading direction feels like a hack, and it is.

You won’t need that hack for long, though, because a new set of writing mode values are coming.

Content flows vertically top-to-bottom and text is written sideways, towards the right.
sideways-rl. Content flows vertically top-to-bottom and text is written sideways, towards the right. (Large preview)
Content flows vertically top-to-bottom and text is written sideways, towards the left.
sideways-lr. Content flows vertically top-to-bottom and text is written sideways, towards the left. (Large preview)

To improve someone’s reading this block of running text, I introduce columns using the column-count property. This design divides my content into two columns, with a gutter and a solid rule between them:

main div {
column-count: 2;
column-gap: 4rem;
column-rule: 1px solid #e9e9e9; }

Browsers adjust the widths of these two columns to fill the available space. When I want to specify column width instead of the number of columns, I use the column-width property with a text-based unit value, including ch, em, ex, rem, vw, vmax, and vmin.

There’s one final touch I want to add to the vertical headline in this design; blending it with the body behind. Alongside background-blend-mode, the Compositing and Blending module includes mix-blend-mode which blends elements with each other. You can use the same fifteen blend modes with either property. Using a multiply value on my vertical headline allows the abstract background image on my body element to bleed through this headline:

h1 {
mix-blend-mode: multiply; }
I’m not advocating a return to the worst excesses of skeuomorphism, but I hope designers realise the value of a more vibrant approach.
I’m not advocating a return to the worst excesses of skeuomorphism, but I hope designers realise the value of a more vibrant approach. (Large preview)

Beyond Primitive Clipping Paths

You probably won’t be surprised to learn that this design uses the same header and main elements as my previous examples. This time, both contain a figure:

<header>
<figure>…</figure>
<h1>The car you <span>always</span> promised <span>yourself</span></h1>
</header>

<main>
<figure>…</figure>
<p>…</p>
<div>
<p>…</p>
</div>
</main>
Left: In the Shade. The Face 1982. Art direction by Neville Brody. Right: Support for clipping paths is now widespread.
Left: In the Shade. The Face 1982. Art direction by Neville Brody. Right: Support for clipping paths is now widespread. (Large preview)

Each figure contains four pictures of my colourful Capris:

<figure>
<img src="capri-front-red.png" alt="">
<img src="capri-back-green" alt="">
<img src="capri-back-brown" alt="">
<img src="capri-front-lime" alt="">
</figure>

I arrange these pictures in a 2x2 grid, then I add a background colour and abstract background image, blending them together with a background-blend-mode:

figure {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2rem;
background-color: #2c5f9d;
background-image: url(figure.png);
background-size: cover;
background-blend-mode: multiply; }

Good typography is as important for personality, as it is for readability. Brody’s designs are distinctive partly because of the original typefaces he created for The Face and other magazines. I set my headline using TokyoTwo — a facsimile of one Brody typeface — to bring a little of his style to my design.

h1 {
font-family: 'TokyoTwoSolid';
font-size: 7vmax;
text-transform: uppercase; }

I highlight specific words by adding span elements around them:

h1 span {
color: #2C5F9D; }

In newspapers and magazines, online and in print, a standfirst is the ‘first’ few lines of an article and should be designed to ‘stand’ out. You might also see standfirst paragraphs referred to as “decks,” “kickers” because they kick readers into the content, “riders,” “summaries” as they often summarise the content of an article, or &mdahs; my personal favourite — “the sell” because one of its jobs is selling content to a reader.

While a standfirst paragraph is often “larger, bolder,” or “in capitals,” that’s not necessarily how it always looks. There’s no rule book to dictate its size or style, or even its position. That’s something important to bear in mind when you’re designing layouts for many different devices or screen sizes. The design of a standfirst should help it do its job and should be designed to catch someone’s eye, encourage people to read on, give people an idea of what an article contains, and improve understanding and share-ability.

To add zig-zag lines and transform this default paragraph into a standfirst, I add :before and :after pseudo-elements, each containing an SVG image which stays crisp no matter how large someone’s device or screen:

main figure + p:before {
content: url(line-1.svg);
display: block;
margin-bottom: .75rem; }

main figure + p:after {
content: url(line-2.svg);
display: block;
margin-top: .75rem; }
A standfirst connects readers with your content and can help people understand what’s coming next.
A standfirst connects readers with your content and can help people understand what’s coming next. (Large preview)

I introduced you to the clip-path property alongside Alexey Brodovitch. It enables you to clip an element so that only part of it remains visible. These paths can be any shape, from basic circles and eclipses to complex polygon shapes with any number of coordinates.

My design uses zig-zags around its standfirst and at the sides of my colour-filled figures. But, those shapes aren’t part of any image attached to a figure, they’re the result of clipping these figures with a polygon path:

figure {
-webkit-clip-path: polygon(0% 10%, 5% 20%, 0% 30%,…);
clip-path: polygon(0% 10%, 5% 20%, 0% 30%,…); }

All that remains is to add background images to the body, adjusting their position and size, plus apply a two-column symmetrical grid for larger screens:

body {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2rem; }

body {
background-image: url(body-small.svg);
background-position: 50% 0;
background-repeat: no-repeat;
background-size: cover; }

@media screen and (min-width : 64em) {

body {
background-image: url(body-large.svg);
background-position: 0 12rem;
background-size: contain; }
}
Clipping paths are a fabulous way to implement irregular shapes which catch someone’s eye and draw them into a design.
Clipping paths are a fabulous way to implement irregular shapes which catch someone’s eye and draw them into a design. (Large preview)

Responsive grids and rotation

To implement my final Brody-inspired design, my aim is to use the most minimal set of structural elements:

<img src="logo.svg" alt="Ford">

<h1>Get a Capri… if you’re quick</h1>

<header>
<picture>
<source media="(min-width: 48em)" srcset="header-lg.png">
<img src="header-small.png" alt="Ford Capri">
</picture>
</header>

<main>
<p>…</p>
<p>…</p>
</main>

<figure>…</figure>
<aside>…</aside>
<div></div>
Left: Ital Style. The Face 1985. Art direction by Neville Brody. Right: Combining grid with transforms makes elaborate designs possible.
Left: Ital Style. The Face 1985. Art direction by Neville Brody. Right: Combining grid with transforms makes elaborate designs possible. (Large preview)

Whereas my earlier designs introduced grid properties at larger screen sizes, this final design uses them from the beginning. In this three-column grid, the two outer column widths are text-based, while the centre column occupies all remaining space:

body {
display: grid;
grid-template-columns: 3rem 1fr 3rem;
background-color: #f0f0f1; }
Before implementing any design, I make a simple storyboard to demonstrate how my elements will flow across a selection of screen sizes.
Before implementing any design, I make a simple storyboard to demonstrate how my elements will flow across a selection of screen sizes. (Large preview)

I start by placing the Ford logo into that centre column and on the first row:

[src*="logo"] {
grid-column: 2;
grid-row: 1;
justify-self: center; }

The header with its Capri image spans every column, and occupies the full page width. I place it in the second row, under my logo:

header {
grid-column: 1 / -1;
grid-row: 2; }

A division acts as an abstract back-drop to my header. It fits neatly into the second column, and spans the first two rows:

body > div {
grid-column: 2;
grid-row: 1 / 3;
z-index: 1; 
background-color: #2c5f9d;
background-blend-mode: multiply;
background-image: url(div.png);
background-size: cover; }

By adding a low z-index value to this division pushes it into the background, and to ensure my logo and header spring into the foreground, I give them a higher value:

[src*="logo"],
header {
z-index: 2; }

That layered header adds depth to small screens, but when more space is available, this design comes to life. The two-column grid is simple, but the row pattern is more intricate and includes a mixture of text-based, flexible length, and intrinsic units:

@media screen and (min-width : 48em) {

body {
grid-template-columns: 1fr 1fr;
grid-template-rows: 16rem 8fr 16rem auto auto auto; 
grid-column-gap: 5vw; }
}

I place the header into the third row and allow it to span the full width of my grid. Then, I slot the remaining elements into their places using grid line numbers:

header {
grid-column: 1 / -1;
grid-row: 3; }

h1 {
z-index: 1;
grid-column: 1;
grid-row: 1 / 3; }

main {
grid-column: 1;
grid-row: 4 / 6; }

aside {
grid-column: 1;
grid-row: 6 / 7; }

body > div {
grid-column: 2;
grid-row: 1 / 4;
border-top: 10px solid #e9e9e9; }
Three different combinations of columns and rows form distinctive grids for small, medium, and large screens.
Three different combinations of columns and rows form distinctive grids for small, medium, and large screens. (Large preview)

I don’t need to style this figure, only its img and figcaption. By applying display: contents;, I’m able to place those child elements onto my grid:

figure {
display: contents; }

figure img {
grid-column: 2;
grid-row: 5 / 7; }

figure figcaption {
grid-column: 2;
grid-row: 4 / 5; }

Now I can rotate my header image and move it up so that it overlaps other elements in my design.

header {
z-index: 2;
transform: rotate(-20deg) translateY(-6rem); }

I’ve always thought of responsive design not as a challenge, but as a chance to be creative. Each breakpoint provides an opportunity to make designs which make the most from every screen size.

For large screens, I replace the previous grid properties with a five column layout where four of the columns are flexible and the other is text-based. I use the repeat value to create six rows which all have intrinsic height. Whereas the default align-items value is stretch, I align my grid items to the start:

@media screen and (min-width : 64em) {

body {
grid-template-columns: 1fr 1fr 1fr 6rem 1fr;
grid-template-rows: repeat(6, auto); 
gap: 1rem;
align-items: start; }
}
This final Brody-inspired design demonstrates how combining grid with transforms makes elaborate designs across screen sizes possible.
This final Brody-inspired design demonstrates how combining grid with transforms makes elaborate designs across screen sizes possible. (Large preview)

I reposition each element onto this new grid using line numbers which separate my content across each column.

[src*="logo"] {
grid-column: 1;
grid-row: 1; }

h1 {
grid-column: 2;
grid-row: 2; }

main {
grid-column: 1 / 2;
grid-row: 2 / 5; }

header {
grid-column: 2 / -1;
grid-row: 2; }

figure img {
grid-column: 3;
grid-row: 1; }

figure figcaption {
grid-column: 3;
grid-row: 4; }

aside {
grid-column: 5 / -1;
grid-row: 3 / 5; }

body > div {
grid-column: 3;
grid-row: 2 / 4;
align-self: stretch; }

Using line numbers enables some elements to occupy the same columns and rows, so they overlap. The higher z-index value I gave to the header earlier, brings the large picture of my Capri into the foreground, where I can adjust its rotation and vertical offset:

header {
transform: rotate(-20deg) translateY(3rem); }

A subtle transition and a series of transform values, add up to a little surprise when someone hovers over the profile of this classic Ford:

header {
transition: transform .25s ease; }

header:hover {
transform: rotate(-21deg) scale(1.025) translateY(3rem); }

Bonus: Introducing CSS masks

In my first Capri design, I added a spark plug silhouette as a background image to my content, but changing its colour would involve exporting a new asset.

Depending on the mask image, there are two types of masks in CSS:

  • luminance
    White areas are transparent, black ones are opaque, and everything in between is semi-transparent.
  • alpha
    The default, alpha-channels.
Left: Mask image. Center: Main content area with a mask applied. Right: The headline and standfirst masked with a CSS gradient.
Left: Mask image. Center: Main content area with a mask applied. Right: The headline and standfirst masked with a CSS gradient. (Large preview)

Masking is a fabulous time-saver which involves a single mask-image with an alpha-channel. Whereas with clip-path, parts of an element or either invisible or visible, using mask-image means parts of an element can be rendered with several levels of opacity.

Elements in parts of a mask which are 100% black will be fully visible. In sections where the mask is 100% transparent, contents will be completely hidden. Any percentage in-between will partially mask an element.

Left: My headline unmasked. Right: The headline masked with a PNG image.
Left: My headline unmasked. Right: The headline masked with a PNG image. (Large preview)

When a mask is applied, only the areas inside it are visible, which allows me to change an element’s background colour or image whenever I need to.

Applying a mask-image is as simple as specifying a mask URL. CSS masks use similar properties and values to background images, so first I specify a mask‘s position, then repeat properties, and its size. mask-position uses X and Y values which are the same as background-position.

As well as common values like repeat, repeat-x, repeat-y, and no-repeat, are mask-repeat also accepts the lesser known tiling values, space and round.

mask-size options include one or two number values, plus contain and cover. I put these properties together to apply a spark plug silhouette mask to my main content:

main {
mask-image: url(mask.png);
mask-position: 0 4rem;
mask-repeat: no-repeat;
mask-size: cover; }

It’s also possible to define which area of a box is affected by a mask by using the mask-clip and mask-origin properties in similar ways to how background-origin and background-position affect background images. You might choose to clip a mask to either the border-box, content-box, or padding-box, plus several other options.

I’m also excited by the possibilities from mask-border, an experimental property which will combine the flexibility of border images with masks.

Masks can add depth to text too. To make my header content shine, I could use a bitmap or a SVG gradient image. But remember, CSS generated linear and radial gradients are also background images, so can be mask images too. They add style with almost no impact on performance:

main {
mask-image: linear-gradient(
transparent, 
rgb(0,0,0) 50%, 
transparent 100%); }

I want a circular radial-gradient to fade the edges of my header content:

main {
mask-image: radial-gradient(
circle at 50% 50%, 
rgba(0,0,0,1), 
rgba(0,0,0,.15) 80%); }

By fine-tuning my alpha channel values and colour stop points, I can create the perfect look to fit my design.

NB: Smashing members have access to a beautifully designed PDF of Andy’s Inspired Design Decisions magazine and full code examples from this article.

Smashing Editorial (ra, yk, il)

Are You Ready to Play Uno Minimalista? We Know We Are.

uno minimalista

Oh, the golden days of Uno, when everyone would carry their pack of fun and good memories in their pocket.

I remember playing Uno all throughout my childhood and even to this day when we get a good old group of friends together, we’ll play our version of Uno extreme.

And there are no promises that someone won’t get hurt, so you play at your own risk.

Uno brings so many good memories to my mind when I think about it, and I was absolutely stoked when I heard the news that they going to make a minimalist version of it.

And we all know I’m a sucker for some minimalist design.

So let’s get into the story behind it all.

Meet Uno Minimalista

uno minimalista

[Image credit: Warleson Oliveira]

Just like we talked about last week, everyone is loving a dark mode of anything nowadays, and many people are calling Uno Minimalista the dark mode of the original Uno.

What started as a petition, is just about to become a reality.

[Image credit: Warleson Oliveira]

Last month, the new concept of Uno Minimalista drove people crazy, in the best way.

There was just an uproar of how people needed this version of Uno in their life. And I was 100% apart of this crowd.

[Image credit: Warleson Oliveira]

Warleson Oliveira was the mastermind behind this gorgeous minimalist concept of Uno that made the internet go wild.

A petition started on change.org to see this concept become a reality and Mattel heard us.

Mattel tweeted out the thing we were all dying to hear. “You asked for it, you got it.”

 

As soon as I saw this, you know I was just dying to get my hands on it, and if you’re anything like me, you probably had your credit card in your hand, ready to go and order a few packs.

Well, unfortunately, we don’t have an exact date yet, but we sure are looking forward to getting our hands on this new Uno Minimalista.

[Image credit: Warleson Oliveira]

They tweeted that we should “stay tuned for the summer”, so within a few short months, we will all be reliving our childhood all over again.

So call your friends and set up a camping trip, get your Uno Minimalista cards ready, and have a great time together creating new memories.

[Image credit: Warleson Oliveira]

We can’t wait to get this new and improved Uno and play all night.

Let us know what you think aboutthis new Uno design in the comments!

What do you love about it or what would you have done differently?

And of course…

Until next time,

Stay creative, folks!

 

Read More at Are You Ready to Play Uno Minimalista? We Know We Are.

How to Use Cookie Retargeting in WordPress to Show Custom On-Site Messages

Do you want to use cookie retargeting in WordPress?

Cookie retargeting is the secret tool already used by many of the most popular websites. It allows you to show custom on-site messages to your users based on their past behavior which helps you boost sales.

In this article, we’ll show you how to use cookie retargeting in WordPress to show custom on-site messages and boost conversions.

How to use onsite cookie retargeting in WordPress

What is Cookie Retargeting?

Cookie retargeting is a marketing technique where websites use cookies to track user behavior and offer a personalized experience.

There are two types of cookie retargeting techniques.

First, there is off-site cookie retargeting. This method is used to track user activities across the web.

Facebook pixel and Google remarketing are two of the most popular advertising programs that allow you to use their massive reach and show targeted ads to people who visit your website.

Secondly, you have on-site cookie retargeting, which allows you to show targeted messages to users based on how they interact with your WordPress website.

What are cookies?

Cookies are small text files containing pieces of data. Websites set cookies in users’ browsers to store temporary information such as login status, user preferences, session details, and more.

How to Use On-Site Cookie Retargeting to Boost Conversions?

There are a number of ways website owners use on-site retargeting messages to boost conversions and increase sales.

For instance, eCommerce stores can show custom offers to users based on how they interact with other offers. This allows you to create a dynamic sales funnel that leads users to make a purchase.

Another use-case scenario would be lead generation. With on-site retargeting, if a user closes one sign-up form, then you can show them a different message with another offer.

On-site retargeting messages are highly effective because:

  • It shows personalized messages to users at a time when they are already engaged with your website.
  • Allows you to create customized campaigns that get better with each user interaction until they convert
  • You save money on paid advertising campaigns by utilizing your existing website traffic to the max

That being said, let’s take a look a how to use cookie retargeting in WordPress.

Creating On-Site Retargeting Campaign in WordPress

The best way to create on-site retargeting messages is by using OptinMonster. It is the best conversion optimization and lead generation software in the world.

You can use it to easily create attention-grabbing signup forms, popups, welcome mats, in-line offers, custom offers, and more.

First, you need to signup for an OptinMonster account by visiting the website and clicking the ‘Get OptinMonster Now’ button. You’ll need at least their Pro plan for cookie retargeting and Growth plan for follow-up campaigns.

OptinMonster

Next, you’ll need to install and activate the OptinMonster plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

This plugin acts as a connector between your WordPress site and the OptinMonster app.

Upon activation, you will see the welcome screen. Simply click the ‘Connect Your Existing Account’ button.

Connect your existing account

Next, a new window will open, where you’ll need to sign in to your account and connect your website with OptinMonster.

Go ahead and click the ‘Connect to WordPress’ button.

Connect OptinMonster to WordPress

Now, you’re ready to create a new campaign.

First, you’ll need to go to OptinMonster » Campaigns from your WordPress admin panel and then click the ‘Create Your First Campaign’ button.

Create first OptinMonster campaign

This will take you to the OptinMonster website, where you’ll be asked to choose a campaign type and a template.

You can choose any campaign type or template, but for this tutorial, we’ll be creating a lightbox popup.

Choose a campaign type and template

You can select any template that you’d like to use for your campaign.

Next, you’ll be asked to provide a name for your campaign and click the ‘Start Building’ button.

Click start building

After that, you’ll enter the drag-and-drop campaign builder interface.

It is a powerful design tool where you can simply point and click on any item to edit it. You can also add new items like buttons, images, columns, and more to your popup campaign.

Edit your onsite targeting campaign

Next, you can switch to the ‘Display Rules’ tab at the top.

Here, OptinMonster will give you different options for displaying your onsite targeting campaigns.

Select display rules

For instance, you can show the popup after users spend a certain time on the page, are from a particular location, or are about to exit your website.

By default, OptinMonster will show your campaign after a visitor spends at least 5 seconds on the site. Plus, it appears on all the pages.

Set up display rules

Once you are satisfied, simply switch to the publish tab.

Next, you’ll need to make your campaign live by changing its status from Draft to Publish. Don’t forget to click the ‘Save’ button when you’re done.

Publish your onsite targeting campaign

Now by default, OptinMonster will show this campaign to all users who visit your website. Users will be able to close the popup or perform their desired action.

Creating a Retargeting Campaign to Show Custom Messages

Now that you have launched your first campaign, let’s add another campaign using the follow-up retargeting feature.

Click on the create new campaign button in the OptinMonster dashboard and select your campaign type and template. Since we have used a lightbox popup, we’ll be using a ‘Floating bar’ as our retargeting campaign.

Choose a floating bar template

After selecting a template, you’ll enter your campaign name.

Then simply click the ‘Start Building’ button to continue.

Click start building

After that, you’ll enter the OptinMonster builder where you can design your campaign using simple drag-and-drop tools.

You can edit the optin text, adjust the countdown timer to generate FOMO, add a coupon, and so much more.

Edit the floating bar campaign

Once you are satisfied with the design, it is time to select which users you want to show this custom message to.

Simply switch to the Display Rules tab at the top of the builder. OptinMonster offers a ton of display rules that you can choose from. You can also add multiple rulesets.

Choose has closed display rule

Next, under the If menu, go to the ‘Personalization’ display rules options and select Has Closed.

After that, select ‘Campaign’ and then select your previous campaign.

Select previous campaign

Next, you need to switch to the ‘Publish’ tab.

Here, simply change your campaign status from Draft to Publish under ‘Publish Status.’ Once that’s done, simply click the ‘Save’ button and exit the campaign builder.

Publish has closed campaign

You can now visit your website in the incognito browser tab to see your campaign and the follow-up retargeting message.

Adding Cookie Retargeting with Custom Messages

Cookie retargeting allows you to show custom messages to users based on their previous actions, cart status, shopping history, and more.

This allows you to create promotions and upsells designed for customers at different stages of your sales funnel.

When customizing your campaign, simply switch to the ‘Display Rules’ tab.

Under the If menu, you can go to the ‘Targeting (Who)’ display rules options and select Cookie Targeting.

Select cookie targeting

Next, you’ll need to enter the cookie key and value. The key is the cookie name, and the value parameter is the contents of the cookie.

OptinMonster lets you select different operators to use for the display rule. These include options like match exactly, contain, exist, start with, ends with, and more operators.

For instance, if you are using WooCommerce, then you can use WooCommerce cookies to target users who have added products to their cart. This way, you can cross-sell items in their cart, reduce cart abandonment, and more.

Enter cookie key and value

After adding cookie retargeting rules, go to the ‘Publish’ tab.

From here, simply change the Publish Status from Draft to Publish for your campaign.

Publish has closed campaign

OptinMonster will now display your custom message based on the cookie-targeting rules you have set.

We hope this article helped you learn how to use cookie retargeting in WordPress to show custom on-site messages. You may also want to see our guide on how to recover abandoned cart sales in WooCommerce as well as our comparison of the best live chat software for websites.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Use Cookie Retargeting in WordPress to Show Custom On-Site Messages first appeared on WPBeginner.