Improving Icons for UI Elements with Typographic Alignment and Scale

Post pobrano z: Improving Icons for UI Elements with Typographic Alignment and Scale

Utilizing icons in user interface elements is helpful. In addition to element labeling, icons can help reinforce a user element’s intention to users. But I have to say, I notice a bit of icon misalignment while browsing the web. Even if the icon’s alignment is correct, icons often do not respond well when typographic styles for the element change.

I took note of a couple real-world examples and I’d like to share my thoughts on how I improved them. It’s my hope these techniques can help others build user interface elements that better accommodate typographic changes and while upholding the original goals of the design.

Example 1 — Site messaging

I found this messaging example on a popular media website. The icon’s position doesn’t look so bad. But when changing some of the element’s style properties like font-size and line-height, it begins to unravel.

CodePen Embed Fallback

Identified issues

  • the icon is absolutely positioned from the left edge using a relative unit (rem)
  • because the icon is taken out of the flow, the parent is given a larger padding-left value to help with overall spacing – ideally, our padding-x is uniform, and everything looks good whether or not an icon is present
  • the icon (it’s an SVG) is also sized in rems – this doesn’t allow for respective resizing if its parent’s font-size changes

Recommendations

Screenshot of the site messaging element. It is overlayed with a red-dashed line indicating the icon's top edge and a blue-dashed line indicating the text's topmost point. The red-dashed line is slightly higher than the blue-dashed line.
Indicating the issues with aligning the icon and typography.

We want our icon’s top edge to be at the blue dashed line, but we often find our icon’s top edge at the red dashed line.

Have you ever inserted an icon next to some text and it just won’t align to the top of the text? You may move the icon into place with something like position: relative; top: 0.2em. This works well enough, but if typographic styles change in the future, your icon could look misaligned.

We can position our icon more reliably. Let’s use the element’s baseline distance (the distance from one line’s baseline to the next line’s baseline) to help solve this.

Screenshot of the site messaging element. It is overlayed with arrows indicating the baseline distance from the baseline of one line to the next line's baseline.
Calculating the baseline distance.

Baseline distance is font-size * line-height.

We’ll store that in a CSS custom property:

--baselineDistance: calc(var(--fontSize) * var(--lineHeight));

We can then move our icon down using the result of (baseline distance – font size) / 2.

--iconOffset: calc((var(--baselineDistance) - var(--fontSize)) / 2);

With a font-size of 1rem (16px) and line-height of 1.5, our icon will be moved 4 pixels.

  • baseline distance = 16px * 1.5 = 24px
  • icon offset = (24px16px) / 2 = 4px

Demo: before and after

CodePen Embed Fallback

Example 2 – unordered lists

The second example I found is an unordered list. It uses a web font (Font Awesome) for its icon via a ::before pseudo-element. There have been plenty of great articles on styling both ordered and unordered lists, so I won’t go into details about the relatively new ::marker pseudo-element and such. Web fonts can generally work pretty well with icon alignment depending on the icon used.

CodePen Embed Fallback

Identified issues

  • no absolute positioning used – when using pseudo-elements, we don’t often use flexbox like our first example and absolute positioning shines here
  • the list item uses a combination of padding and negative text-indent to help with layout – I am never able to get this to work well when accounting for multi-line text and icon scalability

Recommendations

Because we’ll also use a pseudo-element in our solution, we’ll leverage absolute positioning. This example’s icon size was a bit larger than its adjacent copy (about 2x). Because of this, we will alter how we calculate the icon’s top position. The center of our icon should align vertically with the center of the first line.

Start with the baseline distance calculation:

--baselineDistance: calc(var(--fontSize) * var(--lineHeight));

Move the icon down using the result of (baseline distance – icon size) / 2.

--iconOffset: calc((var(--baselineDistance) - var(--iconSize)) / 2);

So with a font-size of 1rem (16px), a line-height of 1.6, and an icon sized 2x the copy (32px), our icon will get get a top value of -3.2 pixels.

  • baseline distance = 16px * 1.6 = 25.6px
  • icon offset = (25.6px32px) / 2 = -3.2px

With a larger font-size of 2rem (32px), line-height of 1.2, and 64px icon, our icon will get get a top value of -12.8 pixels.

  • baseline distance = 32px * 1.2 = 38.4px
  • icon offset = (38.4px64px) / 2 = -12.8px

Demo: before and after

CodePen Embed Fallback

Conclusion

For user interface icons, we have a lot of options and techniques. We have SVGs, web fonts, static images, ::marker, and list-style-type. One could even use background-colors and clip-paths to achieve some interesting icon results. Performing some simple calculations can help align and scale icons in a more graceful manner, resulting in implementations that are a bit more bulletproof.

See also: Previous discussion on aligning icon to text.


Improving Icons for UI Elements with Typographic Alignment and Scale originally published on CSS-Tricks. You should get the newsletter.

10 Responsive Slider jQuery Plugins

Post pobrano z: 10 Responsive Slider jQuery Plugins

We’ve all heard about why we should be using responsive design (beyond the fact that it’s current design trend). But the decision to go responsive raises a number of development questions. One of the biggest issues is handling media. And one of the most common features on a media-heavy website is a featured content carousel (or image slider, image rotator, etc). This post will help you find a solution for your responsive slider needs. We’ve gathered a number of the best  jQuery responsive image sliders to compare and share.

10 Responsive jQuery Image Sliders

Flexslider 2 – Free

flexlslider responsive slider

I use Flexslider more than any other image slider (responsive or not) so it’s a great place to start. Flexslider offers a fullly skin-able and customizable slider that works great across all screen sizes. I  use it with both images and images with text/calls to action. It also offers both horizontal and vertical sliding as well as multiple slider support so you can have multiple image sliders on a single page. Definitely gets my vote!

Royal Slider – Premium

Royal Slider responsive jQuery plugin

Another great slider that I have personal experience with. Royal Slider has a myriad of configuration options (my favorites being the “Gallery with Visible Nearby Images” or the “Video Slider”). The only thing keeping this plugin from the top spot is that it isn’t free (Flexslider is).  However, a very affordable and super-powerful plugin awaits. There’s also a great wordpress version.

Camera – Free

Camera - a free responsive slider

Camera slideshow is an open source project, based on Diapo slideshow and offers a variety of skin and customizable options. I’ve never personally used Camera but the documentation looks thorough and the sampel they provide in the demo looks really nice and clean.

Elastic – Free

Elastic responsive slider

Elastic is presented in a tutorial fashion and includes the downloadable code to get you started using it on your site. This plugin has a much more specific look than some of the other plugins mentioned but there are some cool javascript animations being used.

Advanced Slider – Premium

Advanced Slider - customizable jQuery slider

Another premium slider, Advanced Slider is fully responsive, mobile-ready, and can be used with either HTML markup or XML. The plugin also provides an easy to use API to customize it to your specific site. It comes with various pre-built styles that look nice out of the box.

All in One Responsive Slider – Premium

All in One responsive slider

All In One is an Advanced Jquery Slider which comes in 5 flavors: Banner Rotator, Thumbnails Banner, Banner with Playlist, Content Slider, Carousel. It allows you to easily create powerful sliders with animated text using HTML standard tags, making the slider very easy to setup and maintain.

Responsive Image Gallery – Free

responsive image gallery plugin

Another tutorial by Codrops on how to create a responsive image gallery with a thumbnail carousel using Elastislide. This slider is inspired by Twitter’s “user gallery” and is more useful for image galleries than a featured content carousel. But a free and great plugin nonetheless.

UnoSlider – Premium

Unoslider - responsive slider for jQuery

UnoSlider is a premium jQuery content slider plugin that’s core feature is the number of transition animations offered (the plugin developer claims “unlimited transition animations”). It’s also touch enabled, and offers a variety of other features similar to what’s been mentioned before.

Fluid CSS3 Slideshow with Parallax Effect – Free

parallax and responsive slider

Another great freebie by Codrops (sensing a trend here?). This responsive slider mixes in a little parallax effect (another popular trend). A parallax and responsive site? This plugin is for the ambitious designers out there.

Layer Slider – Premium

parallax and responsive image slider

We’ll end with another parallax/responsive combo (this time a premium plugin). Layer Slider offers something really cool and unique: the ability to control an unlimited number of layers with individual animations. Combing this cool functionality with the responsive aspect and you have yourself a pretty powerful and extensible tool. I’ve had quite a bit of fun playing around with this on a few websites.

What other plugins do you use?

I’m sure I’ve left off some really great plugins and tutorials. But that’s where you come in. Let me know what I’ve missed and what plugins are your favorites. Feel free to post links to examples of these plugins in action. We’d love to see your great work!

The post 10 Responsive Slider jQuery Plugins appeared first on Visual Swirl Design Resources.

13 Beautiful 2013 Desktop Wallpapers for New Years

Post pobrano z: 13 Beautiful 2013 Desktop Wallpapers for New Years

Welcome to 2013! To kick off another great  year I’ve rounded up 13 of the best 2013 wallpapers. Start off the new year by making a plan to clean up your desktop. Once it’s clean, you’ll want to decorate with one of these great wallpaper designs. And if you’re looking for monthly calendars for January, head over to Smashing Magazine to see some really great January 2013 calendars. So find the wallpaper that fits your resolutions (pun intended) and here’s to a happy and productive New Years!

2013 Wallpapers for a Happy New Years

Wallpaper by Upwallpapers.net

2013 Sparks New Years Wallpaper

Wallpaper by demeters

Snowflakes 2013 desktop wallpaper

Wallpaper by paha13

crazy colorful 2013 desktop wallpaper

Wallpaper by GuilleBot

Jungle Wallpaper for 2013 desktop

Wallpaper by paha13

Purple desktop wallpaper for 2013

Wallpaper by PSDRoman

cloud rainbow 2013 desktop wallpaper

Wallpaper by Jenova89

hope and darkness 2013 wallpaper desktop

Wallpaper by Zakzak008

2013 wallpapers balloon new year

Wallpaper by tajio

purple bokeh new years 2013 wallpaper

Wallpaper by Concrete Love

Bright wrapping paper 2013 desktop wallpaper

Wallpaper by danishprakash

2013 New Years Wallpaper

Wallpaper by photonica

January 2013 Desktop Wallaper calendar

Wallpaper by ravirajcoomar

Futuristic 2013 wallpaper

The post 13 Beautiful 2013 Desktop Wallpapers for New Years appeared first on Visual Swirl Design Resources.

Desktop Wallpaper Calendars for August 2012

Post pobrano z: Desktop Wallpaper Calendars for August 2012

August desktop calendars just a couple days late. This collection of desktop calendar wallpapers will help keep your desktops fresh as we roll through the rest of the summer. As always, I’ve hand-picked wallpapers from talented artists and designers  around the web. Feel free to share your favorites and check back next month for some great new desktop calendars. As always, if you’d like to include your own design in future roundups, let me know.

7 Beautiful Desktop Wallpapers for August 2012

Wallpaper by Call Me Victorian

August Flower Calendar Wallpaper

Wallpaper by Paper Leaf

August Desktop Calendar

Wallpaper by Oana Befort

August Blue Whale Wallpaper

Wallpaper by Kriegs

Vintage August Wallpaper

Wallpaper by Kinnon Elliott

Wallpaper by Sarah Hearts

Wallpaper by Happy Serendipity

 

The post Desktop Wallpaper Calendars for August 2012 appeared first on Visual Swirl Design Resources.

Desktop Wallpaper Calendars for July 2012

Post pobrano z: Desktop Wallpaper Calendars for July 2012

July desktop calendars are hot off the press. 2012 is halfway gone but these fun and inspiring calendar wallpapers will surely help you get through the dog-days of summer. These fine wallpapers have been hand-picked from talented artists and designers from around the web. Feel free to share your favorites and check back next month for some great new desktop calendars. As always, if you’d like to include your own design in future roundups, let me know.

5 Desktop Wallpaper Calendars for July

Wallpaper by Paper Leaf

Sandy backgrounds and a retro color scheme comprise this beautiful wallpaper. The script font matches nicely with this “made for the beach” design.

July 2012 Desktop Calendar

Wallpaper by Webgranth

Rainy days may be a title better served for the spring (depending on your location) but regardless, this illustrated desktop calendar provides some optimism for what is typically a scorchingly hot time of year.

Wallpaper by Studio of Mae

Studio of Mae  has another nice  patterned wallpaper ready for July. As always the fonts and minimal calendar go nicely with the lovely background. Enjoy!

Decorative July Desktop Wallpaper

Wallpaper by Kriegs

This darker, grunge based design has some nice inkblot/rorschach digital art working for it. Do you see anything in the ink blots?

July Desktop Wallpaper Calendar

Wallpaper by Cromoart

Abstract shapes bursting from an evening view of the shade tree on a farm. I absolutely love the color scheme. There’s also iPad and iPhone versions available.

Abstract July 2012 Desktop Calendar

That’s the roundup. Please let us know which calendar is your favorite by leaving a comment below.

The post Desktop Wallpaper Calendars for July 2012 appeared first on Visual Swirl Design Resources.

Agregator najlepszych postów o designie, webdesignie, cssie i Internecie