Archive

Archive for 2016

Popular design news of the week: November 28, 2016 – December 4, 2016

December 4th, 2016 No comments

Every week users submit a lot of interesting stuff on our sister site Webdesigner News, highlighting great content from around the web that can be of interest to web designers.

The best way to keep track of all the great stories and news being posted is simply to check out the Webdesigner News site, however, in case you missed some here’s a quick and useful compilation of the most popular designer news that we curated from the past week.

Note that this is only a very small selection of the links that were posted, so don’t miss out and subscribe to our newsletter and follow the site daily for all the news.

What’s New in HTML 5.1

Image Effects with CSS

YouTube Redesign Concept

Here’s What Websites Know About You, Just from the Way You Browse

Alter – A Beautiful Tool to Convert Code into an Image

7 Web Design Dos and Don’ts

Death by Hamburger

Protect your WordPress Site with this Wp-config.php

Jony Ive Designed a Christmas Tree and it Sucks

McGriddle, a Sass Grid Library

Google Releases its own App Builder

Learn How to Track User Behavior with Google Analytics

The Best Email App on iOS Just Got a Desktop Version

Corporate Vs. Design Agency: Perks and Pitfalls for UX Designers

20 Famous Graphic Designers and How They Impacted the World

Ant Design: One Design Language

10 Famous Designers’ Portfolios and What You Can Learn from Them

The Art of Minimalist Design

Character Design in Branding: How Mascots Can Help your Brand Stand Out

How Open Sourcing Bootstrap Made it Huge

Lorem Ipsum Generator — Stylish and Minimal

How to Add Icon Fonts to any Element with CSS

Le Corbusier’s Color Theories, Explained

Dispelling a “Flat Design” Fiction

Learning in the Bauhaus School: Five Lessons for Today’s Designers

Want more? No problem! Keep track of top design news from around the web with Webdesigner News.

Movavi Photo Bundle: Photo Focus, Photo Denoise & Photo Noir – only $29!

Source

Categories: Designing, Others Tags:

Radios and Checkboxes on GOV.UK

December 3rd, 2016 No comments

An interesting journey of form UX, documented by Tim Paul. It started with browser defaults. It’s unclear why that wasn’t working. But interestingly, an alteration that included giant label-based click areas in color-offset boxes didn’t help. What actually helped was bigger (and custom) radios and checkboxes.

So far they’ve tested really well. In research, people of all confidence levels are clicking these controls quickly and easily.

I used to think the size of SurveyMonkey radios was awkwardly large. Now I think it’s probably a smart move.

Direct Link to ArticlePermalink


Radios and Checkboxes on GOV.UK is a post from CSS-Tricks

Categories: Designing, Others Tags:

$1,076,940

December 3rd, 2016 No comments

High five to Dave Gandy and the Font Awesome team:

The Font Awesome 5 Kickstarter raised $1,076,940 with 35,549 backers, making it the most funded and most backed software Kickstarter of all time.

What’s do the funders get? 1,000 more icons, icon font ligatures (a uniquely cool thing fonts can do, like turn “right arrow” into ?, which can be an accessibility win), and, drum roll please, an SVG framework that will be open sourced.

Direct Link to ArticlePermalink


$1,076,940 is a post from CSS-Tricks

Categories: Designing, Others Tags:

Comics of the week #368

December 3rd, 2016 No comments

Every week we feature a set of comics created exclusively for WDD.

The content revolves around web design, blogging and funny situations that we encounter in our daily lives as designers.

These great cartoons are created by Jerry King, an award-winning cartoonist who’s one of the most published, prolific and versatile cartoonists in the world today.

So for a few moments, take a break from your daily routine, have a laugh and enjoy these funny cartoons.

Feel free to leave your comments and suggestions below as well as any related stories of your own…

Cheap designer

A simple request

Fast designer

Can you relate to these situations? Please share your funny stories and comments below…

The Original CMYK Playing Cards – only $9!

Source

Categories: Designing, Others Tags:

The Easy Guide to Making Money from Fonts and Designs

December 2nd, 2016 No comments
christmasdesignbundle-fb

Earning money doing something you love has got to be the pinnacle of working life right?

If you have a design or craft following or know exactly where enthusiastic hobbyists and professionals hang out, you have an excellent opportunity to cash in on that in a few clicks of a button!

Introducing Share and Earn

There are a few similar programs around, but none as in depth or intuitive as Share and Earn by Font Bundles. It’s taken an affiliate program and made it accessible to anybody, of any experience, with any size following. The best thing is they pay more than any similar programs out there, with 25% commission on ALL sales FOR LIFE.

The easy to use share buttons and tracking URL’s mean that in 1 click, you can be enjoying cash rewards for introducing people to the program. The best thing is, you don’t need to really do any selling. The products literally sell themselves, and with their range of premium FREE products, you can entice your audience with products they can try and use.

share and earn 2

The main highlights of the Share and Earn program are:

  • 25% sales for life commission (commission on every purchase a user makes for life)
  • Over 10,000 font and design products which can be shared at the click of a button
  • Payment within 1 hour!
  • Intelligent advanced statistics of where your visitors come from and what they buy
  • Email/Website creatives for any larger campaigns
  • Instant sign up and approval – no lengthy forms

It’s very easy to see why the program has been so popular with crafters and graphic designers, with some easily pulling in recurring 4 and 5 figure monthly sums for little work.

So if you are ready to earn some extra cash doing what you love, head on over and sign up to Share and Earn today!

Read More at The Easy Guide to Making Money from Fonts and Designs

Categories: Designing, Others Tags:

Deal: Create amazing lettering with Art Text, 37% off

December 2nd, 2016 No comments

Lettering is all the rage at the moment. Creating expressive text, that goes beyond what you can do with a single font adds a creative touch to any project. But learning to craft high-end lettering takes years; what’s a designer, who doesn’t have years to spare, to do?

Well, thanks to the Art Text app for Mac, you don’t need to spend years honing your skills, because it can put together fabulous, lettering-inspired text with just a few clicks. And—you guessed it—our sister-site, MightyDeals has put together an awesome deal on this must-have app.

Art Text lets you quickly and easily create lettering work out of text. Perfect for making logos, hero text, banners, and buttons, there are 70+ templates to get you started, all fully customizable; you’ll find 750+ fill tools, with different gradients, textures, and shaders; there are 30+ masks for shadow and glow effects; 1000+ different graphic elements ranging from vector shapes, flash, flare, sparkles, background and textures; 400+ 3D materials, with textures, bump map surfaces, and environment map textures.

With the holidays coming up, this is the perfect way to add some Christmas cheer to your seasonal promotions.

This fun and flexible type tool normally retails at $30, but for a very limited time you can grab it for just $19, that’s a 37% saving! Head over to MightyDeals.com to add this app to your toolbox today.

600+ Premium Photoshop Brushes from Layerform – only $14!

Source

Categories: Designing, Others Tags:

20 spectacular Wildlife Photography Examples for your Inspiration

December 2nd, 2016 No comments
wildlife1

From a close-up of a wasp to a herd of wild horses: Everyone loves beautifully composed photos of majestic wildlife. An adventurous journey to different species and locations. We couldn`t pick a favorite. Here are 20 striking Wildlife Photography examples for your inspiration.

Fénec The soul of the desert

Look at this sweet guy: a fennec (desert fox) from Morocco. It`s the smallest species of the family.

© José Mingorance

Ice age giant

Roy Mangersnes is a award-winning wildlife photographer living in Norway. It`s so cold there:


© Roy Mangersnes

O Dandelion

Boris Godfroid is an insect macro and nature photographer. Look at his colorful Insect portraits.

wildlife3
© Boris Godfroid

The Power of the Criollo

Chris is famous for the highest quality of wildlife and nature pictures. The Criollo is the native horse of Uruguay.

wildlife4
© Chris Schmid

Underwater Elephant

Vitaly Sokol loves underwater photography. One of the most challenging types of photography.

wildlife5
© Vitaliy Sokol

Frog and strawberry

What a combination: a Frog and a strawberry. Great colors and sharp contrasts.

wildlife6
© Oleksandr Voloshyn

American Alligator

Eric is a Self employed press technician, with a great passion for shooting nature photos.

wildlife7
© Eric Isley

Portrait of an Eastern Screech Owl

Graham McGeorge’s work is published in such publications as National Geographic, NY Times Magazine, BBC Wildlife Magazine and much more.

wildlife8
© Graham McGeorge

Moose in mist

The U.S. Fish and Wildlife Service loves Wildlife Photography. Take a look at the official Photostream.

wildlife9
© U.S. Fish and Wildlife Service

***

Sergey Polyushko is a Ukrainian photographer. He mastered the art of eye-catching animal portraits.

wildlife10
© Sergey Polyushko

Hands up

Georg Scharf is a nature photographer from Luxemburg. His landscapes and wildlife photos are spectacular.

wildlife11
© Georg Scharf

Size doesn’t matter

Hint: The pelican swallows everything. There’s also a small fish visible in the pic that ended the same way.

wildlife12
© daniele paccaloni

Duelling Tigers

A play fight in some water at Tiger Palace in Bangkok, Thailand. The capturing of movement is amazing.

wildlife13
© Daniel Sakal

Fox

What a curious baby fox. Please take a look at Roberts galleries.

wildlife14
© Robert Adamec

Curiosity of a Chimpanzee in Men

A chimpanzee at the Limbe Wildlife center in Cameroon. A playful peek from underneath the thence.

wildlife15
© suzanne van dalsen

Om

Pedro Jarque Krebs is one of the best nature and wildlife photographers that you should know.

wildlife16
© Pedro Jarque Krebs

Spontaneous Moments

A harbor seal rests, if only for a moment, in this magic scenery.

wildlife17
© ralph pace

Cherry blossom season

Gorgeous blend of sharpness and blur. And saturated colors!

wildlife18
© FuYi Chen

Gentoo Chicks

Richard has specialized in environmental filmmaking and nature photography. These are two newly hatched Gentoo Penguin chicks.

wildlife19
© Richard Sidey

Swifts Over the Fall

This picture was shot at the majestic Iguazú Falls.

wildlife20
© Francesco Filippo Pellegrini

Categories: Others Tags:

The Power of Controversial Content. The Three C’s of Engaging Content.

December 2nd, 2016 No comments
controversial content

INTRO

Every once in awhile, I stumble upon articles that simply change the way I think completely. Those kind of disruptive articles are really hard to find. And as a marketer, I’m always obsessed with creating that kind of content, disruptive content. Knowing that I could change the way you think, even in the slightest, and that my article could be a pivotal point in your career is simply mind-boggling and it truly resembles the staggering power of content.

Everyday, there are roughly 2 million new articles published on the almighty web and there are 571 websites popping out every 60 seconds.

That data alone is completely and irrevocably humbling.

It just gives you an idea of how small you are. If you aren’t new on the internet and you already have an audience, that’s something that you should take pride in and not neglect it. After all, with great power comes great responsibility.
Knowing that someone, someday, chose to read your article, admire your design, and use your products instead of going to the other gazillion alternatives, is truly mind boggling.

The Three C’s of Engaging Content

Now, in the vastness of content created every day, how do you get noticed? Namely, what sets your article apart and what is your value proposition?

Truth be told, nowadays, getting noticed is a matter of uniqueness. I full heartedly believe that as a modern day content creator, you can’t afford being stuck in the box. You can’t come up with the same ideas you came up with in 2013. There are a few factors marketers use to grab someone’s attention, and I think content creators can pull off the same techniques.
Curiosity, Creativity and Controversy. Or the three “C’s” of user engagement, if you will.

Although this article focuses mainly on Controversy, let’s talk a little bit about the two other C’s.

Curiosity

It’s disturbing but fascinating that we are paradoxically drawn towards some quite unpleasant things. The reason why a video about two guys eating a Carolina Reaper pepper gets more than 18 million views, is the same reason why someone would eat those peppers in the first place. Curiosity. Answering questions like “What happens if..” is fun, and being curious is something we all have in common.

Curiosity is the driving force behind mankind’s never-ending pursuit for knowledge. Curiosity can be the right incentive for an individual to click on your article, view your video, look at your design, or engage with your content for that matter.

Creativity

Differing from the other two, the process of creating something truly creative, requires a tremendous amount of work. It takes a good amount of skill to awe someone with your creative work.

The goal of creative work is to generate emotions. Whatever the purpose of the work itself is, you want people to connect with it. Regardless of the type of content you are creating, the way you deliver your content can make all the difference between standing out among the message flood or getting lost in it. After all, you can have a completely dull, or common idea and just approach it creatively. A great example is Apple. They took comon ideas like an Mp3 player and with the right design, and a creative value proposition, they revolutionised the music industry with the iPod

.iPod Colors

Controversy

The type of controversial content that intrigues a user is so much more engaging than the same old traditional content.

Predicting the outcome of controversial content is arduous, which makes it really difficult to handle. Apple was probably one of the first companies that leveraged controversy as a PR move. the challenge has always been to break rules, to find something unexpected to engage people to tell a story. They knew that this tech is not going to be just another business for Steve, but this is actually going to change the world. They had to introduce the Mac in a dramatic memorable way. They needed something brave, something controversial. The ad depicted a sea of people blindly following “The Big Brother” which people perceived as being IBM. And here comes Apple, viewed as a women that stood up against the big brother through the democratization of computers.

People weren’t talking about the Super Bowl game where the ad was displayed but instead they were talking about the ad, which asserts the viral nature of controversial content.
United Colors of Benetton are known for their controversial ads which are often enough viewed as audacious. In one of their recent campaign, the Unhate campaign, the ads were showing some of the most influential people kissing as a symbol of unity across race, religion and political beliefs. The media exploded. Everyone was talking about the ads, and Benetton’s brand awareness grew exponentially.

benetton controversial

Sometimes, controversial content backfires.

Benetton was forced to pull one of its images from its new ‘Unhate’ campaign. The Italian firm withdrew the photograph featuring Pope Benedict XVI kissing a senior Egyptian imam on the lips after the Vatican denounced it as an unacceptable provocation. Some people would agree that creating that image of the Pope was a bad move and it brought a lot of hate to Benetton from the Catholic community, which is counterproductive considering the message of the campaign. However, it also brought a lot of media exposure, which we all know that it’s always good. Right?

benetton controversy

Final thoughts

Different and original content works. Regarding if it’s categorized as controversial, creative or curious, content that excites people at any level, is usually performing better than the other mainstream content. It gets attention on social media, it generates links and mentions, and it often leads to a huge amount of exposure. As long as controversial content is created and managed with care, it’s a great marketing tool.

Read More at The Power of Controversial Content. The Three C’s of Engaging Content.

Categories: Designing, Others Tags:

Loops in CSS Preprocessors

December 2nd, 2016 No comments

If you’ve ever watched old sci-fi flicks, you know how powerful loops can be. Feed your robot nemesis an infinite loop, and kaboom. Robo dust.

Preprocessor loops will not cause dramatic explosions in space (I hope), but they are useful for writing DRY CSS. While everyone is talking about pattern libraries and modular design, most of the focus has been on CSS selectors. No matter what acronym drives your selectors (BEM, OOCSS, SMACSS, ETC), loops can help keep your patterns more readable and maintainable, baking them directly into your code.

We’ll take a look at what loops can do, and how to use them in the major CSS preprocessors: Sass, Less, and Stylus. Each language provides a unique syntax, but they all get the job done. There’s more than one way to loop a cat.

See the Pen Walkcycle with music loop by Rachel Nabors (@rachelnabors) on CodePen.

(animation by Rachel Nabors)

PostCSS is also popular, but it doesn’t provide any syntax of it’s own. While it’s sometimes called a post-processor, I’d call it a meta-preprocessor. PostCSS allows you to write and share your own preprocessor syntax. If you wanted, you could re-write Sass or Less inside PostCSS, but someone else beat you to it.

Loop Conditions

Star Trek wasn’t entirely wrong. If you’re not careful, infinite loops can slow down or crash your compiler. While that’s not a good way to vaporize evil robots, it will annoy anyone using your code. That’s why loops should always serve a limited purpose — usually defined by a number of incremental repetitions or a collection of objects.

In programming terms:

  1. While loops are generic, and will keep looping while any condition is met. Be careful! This is where infinite loops are most likely.
  2. For loops are incremental, running for a particular number of repetitions.
  3. For-Each loops iterate through a collection or list, considering each item one-at-a-time.

Each type of loop is more narrowly focussed than the previous. A for-each loop is just one type of for loop, which is one type of while loop. But most of your use-cases will fall into the more specific categories. I had trouble finding true while loops in the wild — most examples could have been handled better with for or for-each. That’s probably why Stylus only provides syntax for the latter. Sass provides unique syntax for all three, and Less doesn’t technically have looping syntax at all — but that won’t stop us! Let’s dive in.

Collection for-each Loops

Preprocessor loops are most useful when you have a collection (list or array) of items to loop over — like an array of social media icons and colors, or a list of state-modifiers (success, warning, error, etc). Because for-each loops are tied to a known collection of items, they tend to be the most concrete and understandable loops.

Let’s start by looping through a simple list of colors, to see how it works.

In Sass, we’ll use the @each directive (@each $item in $list) to get at the colors:

See the Pen Sass ForEach List by Miriam Suzanne (@mirisuzanne) on CodePen.

In Stylus, the for syntax (for item in list) handles collections:

See the Pen Stylus ForEach List by Miriam Suzanne (@mirisuzanne) on CodePen.

Less doesn’t provide a loop syntax, but we can fake it with recursion. Recursion is what happens when you call a function or mixin from inside itself. In Less, we can use mixins for recursion:

.recursion() {
  /* an infinite recursive loop! */
  .recursion();
}

Now we’ll add a when “guard” to the mixin, to keep it from looping infinitely.

.recursion() when (@conditions) { 
  /* a conditional recursive "while" loop! */
  .recursion();
}

We can make it a for loop by adding a counter (@i), which starts at 1, and increases with every repetition (@i + 1) as long as our condition (@i <= length(@list)) is met — where length(@list) restricts our loop-iterations to the same length as our collection. If we extract the next list item on each pass, we’ll have a hand-made for-each loop:

See the Pen Less ForEach List by Miriam Suzanne (@mirisuzanne) on CodePen.

In Less, you get to do everything the hard way. It builds character.

Social Media Buttons

Looping through lists can be useful, but more often you want to loop through objects. One common example is assigning different colors and icons to your social media buttons. For each item in the list, we’ll need the name of the site and the brand color for that social network:

$social: (
  'facebook': #3b5999,
  'twitter': #55acee,
  'linkedin': #0077B5,
  'google': #dd4b39,
);

Using Sass, we can access the key (network name) and value (brand color) of each pair using the syntax @each $key, $value in $array. Here’s the full loop:

See the Pen Sass Social Media Loop by Miriam Suzanne (@mirisuzanne) on CodePen.

Stylus has a similar syntax: for key, value in array

See the Pen Stylus Social Media Loop by Miriam Suzanne (@mirisuzanne) on CodePen.

In Less, we have to extract each side of the pair manually:

See the Pen LESS Social Media Loop by Miriam Suzanne (@mirisuzanne) on CodePen.

Incremental for Loops

For loops can run for any number of repetitions, not just the length of an object. You might use this to create a grid layout (for columns from 1 through 12), loop through the color wheel (for hue from 1 through 360), or number your divs with nth-child and generated content.

Let’s start with a loop through 36 div elements, providing a number and background-color on each, using :nth-child.

Sass provides a special for-loop syntax: @for $count from $start through $finish, where $start and $finish are both integers. If the starting value is larger, Sass will count down instead of up.

See the Pen Sass “for” loop by Miriam Suzanne (@mirisuzanne) on CodePen.

The through keyword means our loop will include the number 36. You can also use the to keyword, which does not include the final counter: @for $i from 1 to 36 would only loop 35 times.

Stylus has a similar syntax for incrementing, but to and through are replaced with ... and .. respectively:

See the Pen Stylus “for” loop by Miriam Suzanne (@mirisuzanne) on CodePen.

Stylus also provides a range() function, which allows you to change the size of one increment. Using for hue in range(0, 360, 10) would increase the count by 10 on each repetition.

Less will have to use recursive mixins again. We can create an argument for the number of iterations (@i), guard it with the condition when (@i > 0), and subtract one on every iteration — to make it act like a decreasing for-loop:

See the Pen Less “for” loop by Miriam Suzanne (@mirisuzanne) on CodePen.

It’s worth noting that CSS can also give us the nth-child-numbering without pre-processors. While CSS doesn’t have loop structures, it does provide a counter() that you can increment based on any number of DOM-related conditions, and use in generated content. Sadly it can’t be used outside the content property (yet), so our background-colors are not applied:

See the Pen CSS counter by Miriam Suzanne (@mirisuzanne) on CodePen.

Grid Systems

I use incremental loops occasionally in my abstract Sass toolkits, but almost never in actual stylesheets. The one common exception is generating numbered selectors, either with nth-child (like we did above) or in automatically-generated classes (often used for grid systems). Let’s build a simple fluid grid system without any gutters to make the math difficult:

See the Pen Sass For-Loop Grids by Miriam Suzanne (@mirisuzanne) on CodePen.

Each grid-span is a percentage, using the math span / context * 100% — the basic calculation all grid systems have to make. Here it is again in Stylus and Less:

See the Pen Stylus For-Loop Grids by Miriam Suzanne (@mirisuzanne) on CodePen.

See the Pen LESS For-Loop Grids by Miriam Suzanne (@mirisuzanne) on CodePen.

Unique Avatars

At OddBird, we recently designed an application with default user avatars — but we wanted the defaults to be as unique as possible. In the end, we designed only nine unique icons and used loops to transform them into 1296 different avatars, so most users would never see a duplicate.

Each avatar has five attributes:

<svg class="avatar" data-dark="1" data-light="2" data-reverse="true" data-rotation="3">
  <use xlink:href="#icon-avatar-1" xmlns:xlink="http://www.w3.org/1999/xlink"></use>
</svg>
  1. The starting icon shape (9 options)
  2. Rotatation of 0, 90, 180, or 270 degrees (4 options)
  3. A dark color for fill (6 options)
  4. A light color for background (6 options)
  5. A true/false attribute that reverses the colors (2 options)

The code has six colors, and three loops:

  1. @for $i from 0 through 3 gives us four rotations
  2. @for $i from 1 through length($colors) allows us to loop through the color list ($colors), and assign each color a number ($i). Normally I would use the @each loop to step through the collection of colors, but @for is simpler when I need a number for each item as well.
  3. The nested @each $reverse in (true, false) gives us the option to flip foreground and background for each color combination.

Here’s the final result in Sass:

See the Pen 1296 avatars using multiple loops by Miriam Suzanne (@mirisuzanne) on CodePen.

Converting that to Less and Stylus can be your homework. I’m already tired of looking at it.

Generic while Loops

True while loops are rare, but I do use them on occasion. I find them most useful when I’m following a path to see where it leads. I don’t want to loop through an entire collection or a specific number of iterations — I want to keep looping until I find what I’m looking for. This is something I use in my abstract toolkits, but not something you’ll need very often in day-to-day styling.

I built a toolkit to help me store and manipulate colors in Sass. Storing colors in variables might be the most common use-case for any pre-processor. Most people do something like this:

$pink: #E2127A;
$brand-primary: $pink;
$site-background: $brand-primary;

I know that pink is probably not the only color on your site, but it’s the only one e need for now. I gave it multiple names because it’s useful to establish layers of abstraction — from simple colors (pink), to broader patterns (brand-primary), and concrete use-cases (site-background). I also want to turn that list of individual colors into a palette that my pre-processor can understand. I need a way to say these values are all related, and part of a pattern. That way to do that, I store all my theme colors in a single Sass map, with key-value pairs:

$colors: (
  'pink': #E2127A,
  'brand-primary': 'pink',
  'site-background': 'brand-primary',
);

Why bother? I do it because I can point my style-guide generator at a single variable, and automatically create a color palette that stays up-to-date. But there are trade-offs, and it’s not the right solution for everyone. The map doesn’t allow me to make direct assignments across pairs, like I could with variables. I need a while loop to follow the breadcrumb trail of key-names, in order to find the value for each color:

See the Pen Sass “while” loop by Miriam Suzanne (@mirisuzanne) on CodePen.

I do that all the time, but if you search my code for Sass’s @while, you won’t find it. That’s because you can achieve the same thing with a recursive function, making it reusable:

See the Pen Sass “while” recursive function by Miriam Suzanne (@mirisuzanne) on CodePen.

Now we can call the color() function anywhere in our code.

Stylus has no syntax for while loops, but it does also allow array variables and recursive functions:

See the Pen Stylus “while” loop by Miriam Suzanne (@mirisuzanne) on CodePen.

Less doesn’t have array variables built-in, but we can mimic the same effect by creating a list of pairs, the same way we did for social-media colors:

@colors:
  'pink' #E2127A,
  'brand-primary' 'pink',
  'site-background' 'brand-primary'
;

We’ll have to create our own @array-get mixin to retrieve values from the array using key names, and then create our recursive while loop to follow the path:

See the Pen Less “while” list loop by Miriam Suzanne (@mirisuzanne) on CodePen.

That works for the purpose of demonstration, but there’s probably a better way to do this in Less, since you can alias and name-space variables without using an array (unlike Sass or Stylus):

See the Pen Less name-spaced variables by Miriam Suzanne (@mirisuzanne) on CodePen.

Now that my colors are successfully in one variable, I can use another loop to generate my color palette. Here’s a quick example in Sass:

See the Pen Sass color palette by Miriam Suzanne (@mirisuzanne) on CodePen.

I’m sure you could make that prettier than I did.

Getting Loopy!

If you’re not sure when to use loops in your code, keep an eye out for repetition. Do you have multiple selectors that follow a similar pattern, or a calculation you are doing over and over? Here’s how to tell which loop is best:

  1. If you can list and name the items in your loop, use for-each to cycle through them.
  2. If the number of repetitions is more important than any set of source items, or if you need your items numbered, use a for loop.
  3. If you’ll need to access the same loop with different inputs, try a recursive function instead.
  4. For anything else (almost never), use a while loop.
  5. If you’re using Less… Good luck!

Have fun looping!


Loops in CSS Preprocessors is a post from CSS-Tricks

Categories: Designing, Others Tags:

Web Development Reading List #161: Restyling Form Elements, HTTP/2 HPACK, And The Empathy Vacuum

December 2nd, 2016 No comments

Are you afraid of refactoring code? I love refactoring code. It’s nice to see a code base growing, but this also means that new quirks and suboptimal changes are introduced along the way. At some point, you might realize that there could be a huge opportunity in rewriting the code — to eliminate conflicts or to rename things.

For me, refactoring is both: It’s a challenge to master, but, in the end, also a relief to see how the code evolved. We can’t anticipate everything when we first build modules, and we shouldn’t try to do so either. So let’s not be afraid to set our hands to an already existing code base and improve our code over time instead.

The post Web Development Reading List #161: Restyling Form Elements, HTTP/2 HPACK, And The Empathy Vacuum appeared first on Smashing Magazine.

Categories: Others Tags: