Quick Tips for Creating a Mobile Optimized Site

Quick Tips for Creating a Mobile Optimized Site

Quick Tips for Creating a Mobile Optimized Site

Last year mobile web usage increased 148% worldwide. In the near future as smarthpones become more and more ubiquitous this number will continue to shoot up. As a developer, the time has arrived for you to seriously consider whether you should begin accommodating your mobile audience.
Today we’ll look at a few quick ways to make your site a little friendlier for mobile devices.

Analyze Your Audience

screenshot
Before you dive into improving your site from a mobile perspective, it’s a good idea to check out how much of your traffic is actually coming from mobile devices. Using Google Analytics or something similar, take a quick peek at the browser breakdown just to familiarize yourself with this number. Then you can make an educated decision on how far to go with your mobile accommodation.
One thing to keep in mind is that if this number is super low, it might be partially due to the current poor state of your site on mobile devices. Make a decision regarding whether you want to simply improve the experience of your current mobile users or actively seek more mobile users by launching a dedicated mobile site, web app or iPhone app.

Create Mobile Stylesheets

screenshot
One of the biggest steps you can take towards making your site mobile-friendly is to create customized CSS that targets mobile devices. This can be a much smaller task than you might imagine if you’re looking to keep the overall look and feel of the site. Let’s look at how to aim your mobile CSS to load only on mobile devices.

Media Types

Using different media type declarations allows you to assign different stylesheets for certain uses. Most desktop browsers recognize “screen” while many mobile devices use the “handheld” command. Check out the following example:


Using this simple declaration, you can create a handheld.css file that will only be activated on handheld devices (at least those that allow styling). This of course won’t work on every device, but it will hit a decent amount. Some developers even go so far as to suggest using this method with an empty stylesheet just to reset everything and make it simple for mobile viewing.

Use Fluid Layouts

Unfortunately, it’s not easy to discover how your layout will look on all mobile browsers as there are far too many devices to be able to track them all. One way you can bypass this problem is to use fluid layouts that will automatically adjust to the screen size.
One way to accomplish this is to avoid setting widths in pixels and shoot for percentages or ems instead. For instance, instead of


simply use


To download some great pre-built fluid mobile layouts, check out the article below:
Perfect multi-column CSS liquid layouts – iPhone compatible
screenshot

Hide Unnecessary Content

screenshot
If your site has lots of small footer links or cluttered ad space, it’s a good idea to ditch this content in the mobile version. Keep in mind that the small screen size of mobile browsers is not ideal for clicking on small items or scrolling around on large, content filled pages. Try to trim your content to make it easy to browse in a single column format with large, clickable areas and clearly defined headers.
Insert the following CSS for any element that you wish to hide:

Properly Sizing Images

Large images may or may not display properly in mobile browsers and you can bet they’ll really bog down a mobile site. It’s a good practice to size them down either on the server or using CSS using the max width command. Just keep in mind that the latter is a bit more processor intensive and can take some time to load.
Making sure images aren’t too large isn’t your only problem. As stated in the previous tip, clickable areas need to be rethought as well. Many mobile devices use a finger as the primary input device, which is considerably less accurate than a mouse and pointer. Because of this, any images that serve as buttons or links require consideration and possibly resizing to ensure they are easily selectable with a point and touch instead of a point and click. Unsure about how big to make a button? Look at the size of your own fingertip as an indicator for whether or not an image can easily be selected on a mobile device.

Interactivity

Sometimes adding a few interactive elements to a site make it much more enjoyable and less static/boring. However, on the mobile optimized version of your site, cut down the interactivity to a minimum (unless of course you’re creating a game or something similar). Interaction can easily go wrong on mobile devices and leave your users frustrated with all the work they have to do. Look for places to cut back on the input you require from users, especially in the area of text entry as using tiny keyboards can be among the worst parts of the mobile web experience.

iPhone Specific Techniques

screenshot
Many of you came to this article looking not so much for information on the mobile web in general but in hopes that you’ll find some good iPhone optimization tips. I’d hate to disappoint so here are some things you can do accommodate the king of mobile web clients.

Adding a Home Screen Icon

iPhone and iPod Touches have a built-in feature that allows users to add your site to their home screen as an icon. You can customize this icon simply by placing a file in your root directory titled “apple-touch-icon.png” (make sure the image is at least 57×57). Alternatively, you can place the following snippet in your HTML:


Obviously, you’ll customize the file path and name for your own image.

Viewport: Default Zoom

Your site might have built-in white space that looks great on a desktop but this will add an extra zoom in step for iPhone users who don’t wish to see that white space because it cuts down the readability and size of the main content. Use the following snippet to automatically zoom into the width of your content.


The “width=320;” determines the magnification level of the content. Set this number to whatever is appropriate for your content (320 pixels is the width of the iPhone screen in a vertical orientation).

iPhone Specific Stylesheet

If you want to create CSS that only applies to your iPhone users, use the following code:


This targets only devices with a maximum screen width of 480 pixels, namely iPhones and iPod Touches.

Mobile Site Builders

There are a few sites out there that help you create a mobile site with little to no knowledge of HTML and CSS. The most promising of these in my opinion is Mobify, but I’ve thrown in a few alternatives as well. If you’ve tried any of these (or others), let us know the pros and cons and your overall impression.

Mobify

screenshot

Mofuse

screenshot

Wirenode

screenshot

bMobilized

screenshot

Zinadoo

screenshot

Further Reading

Check out these other great articles for creating mobile optimized sites. Each of these helped me in my research and are full of additional information.

Conclusion

The tips above represent just a few ways you can start to address the growing segment of mobile web users. Use the comments below and share your tips for mobile optimization. I’m eager to learn from you as well!
Best Resources for Learning WordPress Development

Best Resources for Learning WordPress Development

Best Resources for Learning WordPress Development

Odds are, if you’re a web developer, learning WordPress is either on your todo list or something that you’ve already committed yourself to. Learning to build WordPress themes is an excellent professional move that will open you to a wealth of new clients and personal opportunities.
To follow up our article last week on tutorials for learning web design, below is a list of books and free tutorials specifically targeted at learning to develop for WordPress. Whether you’ve never heard of WordPress or are just looking to update your current WordPress skill set, there are plenty of resources below to get you on your way.

Free Tutorials

If you’re on a budget and need to learn quick, free tutorials provide a great way to get started and provide just enough information to help you pick up WordPress without bogging you down with too much unnecessary extras.

WordPress 3.0: Ultimate Guide to New Features (Six Revisions)

Many of the articles below are for older versions of WordPress so I wanted to begin by pointing out this guide to WordPress 3.0. The older articles still have plenty of solid information and relevant examples, just be sure to keep the newest version of WordPress in mind when reading them.
screenshot

How to Create a WordPress Theme from Scratch: NetTuts

“Following on from the recent article on “PSD to HTML”, this tutorial will look at taking a HTML/CSS template and turning it into a functioning WordPress theme. There is so much you can do when creating your own theme we couldn’t nearly cover it all. So, we’re going to look at how themes are structured, creation of the core files and splitting up that index.html file.”
screenshot

Designing for WordPress: CSS Tricks

“Over the last few weeks, I have been been doing a video screencast series on Designing for WordPress. It is a three-part series which covers downloading and installing WordPress on a server all the way to a completed theme.”
screenshot

Premium WordPress Theme Design: Design Reviver

“This time you’ll learn how to slice the design and convert it into XHTML + CSS, then I’ll show you how to use the css files to mock-up a WordPress template.”
screenshot

WordPress Theme Development Checklist: divtodesign

“As you might know, I have been diving into WordPress theme development and I’ve learned many tips and tricks along the way. I noticed I was forgetting about some small issues all the time. That’s why I decided to make a WordPress Theme Development Checklist. ”
screenshot

How To Create WordPress Themes From Scratch: ThemeTation

“I’m going to show you how to create a wordpress theme from scratch in these 3 parts of tutorial series. I will cover from Structuring, designing in Photoshop, slicing, coding into fully css based html, and finally wordpress implementation.”
screenshot

Creating WordPress Themes: Introduction

“This new series will begin with the basics and then I’ll proceed to more advanced techniques. I will also be incorporating different techniques that I’ve picked up from other developers that I’ve found to be extremely handy, and I’ll be providing links and credits to that info as I go along.”
screenshot

Developing a WordPress Theme: Dezinerfolio

“Instead of coming up with some more themes, we decided to write a tutorial on how to develop a wordpress theme which we are sure will help a lot of you to design as you wish and bring them out into wordpress. We are not too advanced wordpress developers but still we are sure the below tutorial will help you successfully develop a wordpress theme. Below you will learn to convert your xHTML CSS site into a Compact WordPress Theme (final output is same as the normal theme but here code is shorter and easier to understand).”
screenshot

How to Build a Custom WordPress Theme from Scratch: SpoonGraphics

“If you’re confident with your CSS and HTML, it’s not hard at all to step up to the challenge of building a custom WordPress theme. This overview shows the process of how my latest custom WordPress theme was built from design concept through to completed theme. See how the static design is split up into the various WordPress theme files, and discover how the simple PHP snippets can add that dynamic functionality of a blog.”
screenshot

Creating A Quality WordPress Theme: 12 Points to Consider (Noupe)

“But what exactly makes a WordPress theme great? How does one go about creating a quality theme? In fact, it’s not that difficult. You can do a few simple things while developing your theme—from the planning stage right through coding—to make it stand out from the legions of average (and below-average) themes out there.”
screenshot

Customize Your Own WordPress Theme: Vandelay Design

“An increasing number of businesses and website owners are using blogs as a means of communication with their customers and website visitors. If your business already has a website it is possible to have a blog that matches the look and feel of your existing website without doing a complete re-design and without paying thousands of dollars to have the blog developed. Using WordPress you can tailor an already existing blog theme to seamlessly flow with the rest of your website.”
screenshot

Designing and Coding a WordPress Theme From Scratch: DeveloperTutorials

“In this multi-part series I’ll detail how to create and design a WordPress theme from nothing more than your imagination using Photoshop, CSS, XHTML and PHP.”
screenshot

So you want to create WordPress themes huh?

“Creating a WordPress theme from scratch is not hard. I’ll hold your hand through it. Tutorials on this topic have been written before and the WordPress website also has guides for you to follow. But are those tutorials and guides really helpful to you when you don’t understand the lingo? Even I got lost while reading the WordPress guides.”
screenshot

Create Your Own WordPress Theme from an HTML Template

“In this article, I’ll show you how to take an existing HTML and CSS site template and convert it into a theme for WordPress. Of course, WordPress theming is much too vast a topic to cover entirely in a single article, so I’ll provide you with some resources at the end to further your learning. It’s hoped, though, that this article will serve as a good introduction and give you a solid foundation to start learning about creating your own WordPress themes.”
screenshot

How To Create a WordPress Theme: The Ultimate WordPress Theme Tutorial (ThemeShaper)

“In Only 11 Individual Lessons this WordPress Theme Tutorial is going to show you how to build a powerful, up-to-date, WordPress Theme from scratch. As we go along I’ll explain what’s happening including (for better or worse) my thinking on certain techniques and why I’m choosing one path over another. Essentially, I’ll be teaching you everything you need to know about WordPress Theme development.”
screenshot

Building Custom WordPress Theme

“This chapter will show you how to build a custom WordPress theme. Although the Codex site provides very good documentations on how to create a theme, but I find it too complicated for a beginner. In this tutorial, I will explain the basics of how WordPress theme works and show you how to convert a static HTML template into a theme. No PHP skill is required, but you need Photoshop and CSS skills to create your own design.”
screenshot

Books on WordPress

If you’re serious about becoming a professional WordPress developer, it’s time to pick up a good book on the subject. These are usually far more in-depth than free tutorials and really cover the material you need to know inside and out.
Below are a few great books to consider in your search. Some are physical books that you can purchase on Amazon, others downloadable PDFs.

Rockstar WordPress Designer: $29

“During the course of the book you’ll build THREE WordPress themes, a blog, a portfolio site and a general site with menus and submenus. Each theme demonstrates different aspects of WordPress theming and all three are packaged in with the book so you’ll have Photoshop, HTML, CSS and WordPress PHP files to refer to.”
screenshot

Beginning WordPress 3: $26.99

“WordPress is one of the most popular blogging and content management web templating platforms—it easily allows you and your business to make a statement about yourself and what you do. WordPress is also quite cost-effective, as it’s free for just about anyone to use. WordPress is colorful and flexible, and includes a variety of themes, templates, and plug-ins for you to explore and use. Beginning WordPress 3 aims to address these for the beginner who wants to start using and developing with WordPress.”
screenshot

WordPress For Dummies: $16.49

“The bestselling guide to WordPress, fully updated for newest version of WordPress. WordPress, the popular, free blogging platform, has been updated with new features and improvements. Bloggers who are new to WordPress will learn to take full advantage of its flexibility and usability with the advice in this friendly guide.”
screenshot

Smashing WordPress: Beyond the Blog: $29.69

“Smashing WordPress shows you how to utilize the power of the WordPress platform, and provides a creative spark to help you build WordPress-powered sites that go beyond the obvious. You will learn the core concepts used to build just about anything in WordPress, resulting in fast deployments and greater design flexibility. Inside, WordPress expert Thord Daniel Hedengren takes you beyond the blog and shows you how WordPress can serve as a CMS, a photo gallery, an e-commerce site, and more.”
screenshot

Professional WordPress: $29.69

“An in-depth look at the internals of the WordPress system. As the most popular blogging and content management platform available today, WordPress is a powerful tool. This exciting book goes beyond the basics and delves into the heart of the WordPress system, offering overviews of the functional aspects of WordPress as well as plug-in and theme development.”
screenshot

WordPress: Visual QuickStart Guide

“This book gives readers the tools they need to create beautiful, functional WordPress-powered sites with minimal hassle. Using the WordPress user interface as a baseline, authors Jessica Neuman Beck and Matt Beck walk new users through the installation and setup process while providing valuable tips and tricks for more experienced users. With no other resource but this guide, readers can set up a fully-functional and well-designed WordPress site that takes advantage of all the features WordPress has to offer.”
screenshot

Using WordPress: $16.49

“WordPress has grown into the #1 blogging tool in its category: several million bloggers have downloaded this powerful open source software, and millions more are using WordPress.com’s hosted services. Thirty-two of Technorati’s Top 100 blogs now use WordPress. Using WordPress is a customized, media-rich learning experience designed to help new users master WordPress quickly, and get the most out of it, fast! It starts with a concise, friendly, straight-to-the-point guide to WordPress. This exceptional book is fully integrated with an unprecedented collection of online learning resources: online video, screencasts, podcasts, and additional web content, all designed to reinforce key concepts and help users achieve real mastery. The book and online content work together to teach everything mainstream Wordpess users need to know.”
screenshot

Head First WordPress: A Brain-Friendly Guide to Creating Your Own Custom WordPress Blog ($23.09)

“Whether you’re promoting your business or writing about your travel adventures, Head First WordPress will teach you not only how to make your blog look unique and attention-grabbing, but also how to take advantage of WordPress platform’s more complex features to make your website work well, too. You’ll learn how to move beyond the standard WordPress look and feel by customizing your blog with your own URL, templates, plugin functionality, and more. As you learn, you’ll be working with real WordPress files: The book’s website provides pre-fab WordPress themes to download and work with as you follow along with the text.”
screenshot

Closing Thoughts

I hope the resources provide the catalyst you need to begin your journey as a WordPress developer. In closing, I want to remind you that the official WordPress codex is definitely on of the best resources out there for all things WordPress.
Let us know in the comments below if we left out any of your favorite tutorials or books for learning WordPress.
Entering the Era of Device Testing

Entering the Era of Device Testing

Entering the Era of Device Testing

This article will discuss the history and future of the web and what implications that has for how device testing will begin to play a larger role in the obligations of web designers.
As the presence of web enabled devices increases the key question that will arise relates to not only whether or not your design will function on a given device, but also (and perhaps more importantly) how high the quality of the experience will be on that device.

The History

The Internet used to be something that you kept in one place. It sat idly by in your office while you lived out your life with only the occasional need to fire up the connection through your phone line and check an email address that no one ever sent anything to.
Many of us saw the mass amounts of potential and knew that the possibilities were endless, but still couldn’t really think of a reason to be online very often. Our lives had been just fine without this strange new connection to the rest of the world and though it excited us to have it, there wasn’t much in our daily lives that called on us to actually use it.
As time went on, those few souls who really grasped the potential of this world-shaking technology gradually developed sites and applications that gave us practical and addicting reasons to continually check in online. We began to grow accustomed to an unlimited stream of information and started actually seeing the Internet as an essential household necessity.
It was where we started research papers, caught up on the news, looked for a dinner recipe, learned to play a song, and found out who that one guy in that one movie was. And the biggest revolution? Communication. The Internet suddenly provided us with new and exciting ways to keep up with both the people we loved the most and the people we were only mildly interested in hearing about.
However, while this communication revolution was taking place in the office, another was exploding in the streets. Cellular phones had become the hottest item on the planet, magically providing us with a constant, invisible tether to everyone we knew. Our insatiable thirst for constant communication had begun to push cell phones into the hands of adolescents, grandmas and every one in between.
Looking back, it’s easy to see that these two linked but separate revolutions were on a collision course that would change the world forever.

The Future

As we know, the mobile phone revolution did indeed collide with that of the Internet. As with the “normal” Internet, the mobile web was so limited at first that few really saw the need. The Internet had been built to be a rich, dynamic and Interactive place and many cell phones didn’t have so much as a color screen. Consequently, many thought they knew the future of the web: mobile.
In their limited grasp they envisioned a future with two Internets: the big one that you left at home and the small one that you took with you. However, this was merely a transitional period and not the true future of the Internet. The mobile web, though still a hot buzz item, is gradually giving away to something else entirely.
The birth of the smartphone marked a new era where these two technologies were finally able to collide with near full force into the explosion of constant information and entertainment we know today.

Not Mobile

It is here that we venture outside of our 20/20 vision regarding what has happened and look through our incredibly inadequate prescription lenses towards the future. My prediction is this: The future of the web is not mobile.
To say that the future of the web is mobile is to focus on a small portion of the greater puzzle. The future of the web is not in cell phones. These devices are constantly evolving and will feed the revolution, but computers aren’t going away any time soon. The mobile trend does however provide us with the biggest key insight into the future. In this future our lives are inexorably intertwined with the Internet as the hours and locations where we aren’t hooked in dwindle and disappear. We won’t take the Internet with us, it will take us with it.
The future of the web is not mobile, it is ubiquitous.

The Era of Devices

screenshot
The lengthy and overly dramatic narrative above is meant to get you thinking about the current state and possible future of web user trends. It used to be the case that a web designer’s biggest obstacle to tackle was cross-browser compatibility. In fact, this still holds true for many designers.
However, as the ubiquity of the web increases, the looming issue of device testing increases in importance. The Internet has leapt out of the desktop computer and into notebooks, netbooks, cell phones, mp3 players, tablets, and countless other devices.
As time goes on, technology fuses more and more with the web, giving you an ever increasing amount of variables to consider for how people are experiencing the websites you build.

The Real Goal of Device Testing

Fortunately, as technology improves so too does the compatibility of these devices with the web the way it was always meant to be. Though debates rage over which technologies should be supported, there is at least a strong core of support rising out of widely agreed upon standards in HTML, CSS and even JavaScript.
However, though your device testing duties may ease in some respect as certain technologies triumph over others and are adopted as standard by device manufacturers, never forget that this is not merely a question of compatibility. We can get so tangled up in making everything compatible that we forget the real goal entirely: the experience.
It is the user experience that is your ultimate end game as a web designer. Device testing then goes well beyond whether or not a site simply loads on a certain device to how it feels.

Focusing on the Experience

In a recent blog post titled Designing for iPad: Reality Check, the web developers at Information Architects discussed how they went about developing for the iPad before anyone could actually even get a hold of one. They used clever tactics like printing out screens and applying them to scale models, but ultimately nothing could provide a decent substitute for the real thing.
It wasn’t until they actually saw and experienced their application on the device that they were able to really fine tune the nuances of the experience. Armed with experiential knowledge of factors such as screen brightness and resolution, gesture friction, and device maneuverability, they are now much better equipped to tackle the task of creating enjoyable and effective user experiences for the iPad.
This is where the heart of device testing lies. When you leave behind compatibility and enter into experiencing for yourself how your designs fare on a given device. As you get a feel for popular devices, you can apply knowledge gained from concrete experience to the earliest stages of design to ensure that the users you want to target are getting the experience you want them to on the devices you know they’ll be using.

Closing Thoughts

Obviously, the depth of your duty in this regard will scale with the size and budget of the project. But in general, you have an obligation as a designer to pay close attention to trends in device usage and to familiarize yourself with the experience of using the gadgets driving those trends.
The more you familiarize yourself with a given device, the fewer unpleasant surprises the testing stage will bring. Sometimes the goal will be a widespread “acceptable” experience on as many devices as possible, other times it will be to really shine on a specific device at the expense of others. Great designers will be able to pull off either task equally well. Will you?
Let us know in the comments below how you think the rapid expansion of online devices will affect the future of web design.
Create a Color Changing Website Using CSS3

Create a Color Changing Website Using CSS3

Create a Color Changing Website Using CSS3

Though the changes implemented by CSS3 are still not supported on all browsers and cross-browser functionality across those that do support it can be a real pain, it’s still quite fun to experiment and see what’s possible.
In this brief tutorial we’ll take go crazy with CSS3 transitions in Webkit to create a simple web page that showcases some really nice color fade effects.

Final Effect

Just so you can get a feel for where we are headed, here’s a demo of the final effect.
screenshot
screenshot
As you can see, we’re utilizing Webkit CSS3 transitions to change the background color, text color, link color and hover link color to add some life to an otherwise simple web page. As you move your mouse into the rectangle, the background, text color and link color change. Then hovering over a link will trigger another color transition for the link text.
We’ll have to stick to Webkit on this one as Firefox transitions are still forthcoming (look for -moz-transition in Firefox 3.7).

CSS3 Transitions

Before we begin, let’s take a look at the basic syntax of the CSS3 transitions we’ll be using. Basically, Webkit transitions work by specifying three items: the property to be transitioned, the duration of the transition, and the timing function. Here’s an example.


In the example above, we’ve chosen to transition the color in a linear fashion over a period of one second. The timing function controls the speed of the change over the duration of the transition. Choosing linear keeps the rate of change steady while choosing ease-in will slightly speed up the transition as it progresses. For a detailed explanation of the timing function options, check out Webkit.org’s article on CSS Animation.
The example above only selected a single property to transition but we can also choose to transition multiple properties in a single command. Consider the following:


This example selects both the text color and the background color (separated by commas) for a one second transition. The timing function for the “color” property is linear while the “background” property is assigned the ease-in function.
To learn more about this example, check out the NetTuts article on CSS3 transitions.

Getting Started: The HTML

The first thing we’ll do is throw down a basic blank XHTML template (we could’ve just as easily used HTML5 but I decided to focus on one new technology at a time).


After you’ve got your empty template hashed out, add a single div to hold the text. Type whatever you want in this area, just be sure to add some links so you can get the full effect of the transitions.


That’s it! As I said before, we are building an extremely simple example so that’s all the HTML you’ll need. I gave the div a class instead of an id so you can easily add other areas to the page that will carry over this functionality.

Basic CSS

The HTML has only yielded a single, boring paragraph at this point so we’ll rely heavily on CSS to make the page more attractive.
To start off, we’ll add some basic styling directly to the body.


Here we’ve set some basic styles for the background, the text container and the links in the text container. We gave the background a really dark gray color, made the text white and used Chris Coyier’s Better Helvetica snippet to give us some nice thin text.
Lastly, we’ve styled the links so that they are a light gray and have no text decoration. Here’s what you should have at this point:
screenshot
Next we’ll expand the textContainer section by giving it a thin border and aligning it with the center of the page. This last part (centering it all on the page) is accomplished by giving the div a width and setting the margin to auto. Make sure you center align the text as well so it’s not hanging out at the left side of the div.


This should give you the basic look you saw in the demo.
screenshot

Adding The Magic

Now that we’ve got our page basically styled, we want to add a few color transitions to liven things up. The first place we’ll want to throw in a transition is in the main textContainer. We’ll use the same code that we saw in the explanation of CSS3 transitions above.


This will set a transition on any change we make to the “color” or “background” properties, using a one second transition and two different timing functions: linear and ease-in respectively.
Next we’ll set a transition to the link text so that any change we make to this color will trigger a second transition.


As stated above, this code by itself won’t do anything. It sort of just keeps an eye out for any changes to the specified properties. When a change does occur due to other CSS commands, it will transition it with these settings.

The Catalyst

When setting up transitions, you need an event to trigger the transition. In CSS, one of the easiest and most common events to work with is a hover event. Though hover events are most commonly applied to links (which we’ll do), we’ll also apply one simply to the div as a whole so that as the mouse enters, the transition is triggered.
Since we’ve already setup the transition commands, the hover events are really easy and only utilize a few lines of code to change the colors around. First we’ll tackle the div hover event.


This will make it so that when someone’s cursor enters the div, the text color will change to dark gray and the background will change to white. However, our link colors are currently staying the same gray as they were before the hover event. Add the following code to change this.


This sets it so that when a hover event occurs in the .textContainer, all links will change to a light blue. Finally, we want to set color of the light blue text to darken gradually as you hover over it.


Note that there is a big difference between .textContainer:hover a and .textContainer a:hover. The former affects the link color when your mouse enters anywhere into the div and the latter affects the link color when you hover the links only.
That finishes up our CSS as well. Now when you enter the div with your mouse, the background should gradually fade to white, the text should turn dark gray and the links should become light blue. Then when you hover over a link it should gradually become darker.
screenshot

Conclusion

I hope this article has sparked a few ideas in your own head for some fun things to do with CSS transitions. Let me know in the comments below what you thought of the overall effect and how you’d improve it. Also be sure to share any links you have to other CSS3 transition examples.

Kategori

Kategori