Wednesday 29 February 2012

iCan't Internet

iCan't Internet


iOS 5 and iCloud:- Amazing Aspects You Might Not Know

Posted: 28 Feb 2012 11:08 PM PST

With Apple venturing into the cloud-based world, we’ve now witnessed the inclusion of a number of popular apps into their newest operating system. With Apple venturing into the cloud-based...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Adsense: What? Where? How? How much?

Posted: 28 Feb 2012 04:37 AM PST

This article is not really an article, it is an overview of some of the most popular Adsense articles that have been published on iCantinternet.org, and that might just be helpful to you. The first...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Tuesday 28 February 2012

iCan't Internet

iCan't Internet


Server Header Responses: The List

Posted: 27 Feb 2012 05:22 AM PST

Wether you’re a webdeveloper, a server administrator, a mere mortal surfing the web, or just a nerd trying to understand everything you come across, Server Header Responses are something that...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]


WordPress and “Briefly unavailable for scheduled maintenance. Check back in a minute.”

Posted: 27 Feb 2012 03:54 AM PST

Do you know the message: “Briefly unavailable for scheduled maintenance. Check back in a minute.”? But you don’t know how to get rid of it? You get this message on your WordPress...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]


Monday 27 February 2012

Is It Time To Change Our CSS Practices? | Van SEO Design

Is It Time To Change Our CSS Practices? | Van SEO Design


Is It Time To Change Our CSS Practices?

Posted: 27 Feb 2012 05:30 AM PST

We’ve been using css as the presentation layer of web pages for quite some time. I’ve personally been using it for about 10 years and like many, much of my css practices were developed nearly as long ago. Is it time to change those practices?

Nicole Sullivan thinks so and I have to agree. She’s been giving presentations about our flawed css practices for at least the last year, and I think longer than that.

Last week I talked about how I’d like to organize css files around different aspects of design and mentioned a few css related topics I wanted to cover in the coming weeks. This is the first of those posts.

Our Flawed CSS Practices

Above are the slides for Nicole’s presentation on css flawed practices. I couldn’t get the video to embed here, but the previous link will take you to it. The video is 35 minutes long and worth a watch if you want the complete picture.

Though some of the specifics have varied from presentation to presentation, Nicole’s thoughts come down to a handful of different concepts. Below are practices the industry has held for years that perhaps need to change.

  • Sites need to look the same in all browsers
  • Pixel based sites are bad
  • You should never add non-semantic markup
  • You should use descendent selectors exclusively
  • Classitis is bad and to be avoided at all costs

I hope we all agree that as an industry we’ve accepted that sites are never going to look the same in all browsers no matter how hard we may try and we should take a more progressive enhancement approach to development.

I disagree with Nicole’s idea about using pixels, though. She’s seeing this entirely in terms of page zoom and considers the move to ‘em’s and other relative measurements as no longer necessary.

The ideas behind responsive design and designing from the content out are right to call for more relative based measurements for most things.

Let’s look at the last 3 items on the list in a little more detail.

Various css selectors

Descendent Selectors

We’ve been taught for years that best practice is to use descendent selectors to style our html. However this approach can become difficult to maintain and even lead to possible performance issues.

For example you might set styles on your generic h2. You then want the h2s in your sidebar to look a little different and further complicating matters you want a specific h2 in the sidebar to look different still

 h2 {font-family: "Helvetica"; font-size: 1.2em; color: red; margin: 0} #sidebar h2 {font-family: "Georgia"; font-size: 1em; color: #000; margin: 1em 0;} #sidebar .related h2 {font-family: "Helvetica"; font-size: 0.9em; color: red; margin: 0} 

The above isn’t overly complicated, but it’s not too hard to imagine it becoming more and more complicated as you create ever more specific selectors that need to be overwritten. Later a change needs to be made and you have to write even more specific selectors or worse add an !important declaration, because you can’t figure out how to make something specific enough to take hold.

I’m sure you’re written the occasional

 #sidebar .related h2.boxed ul ul a {styles here;} 

or something like it before. I know I have. I try my best to start with the least amount of selector specificity as possible when writing general styles, but that only postpones the problem. Our way of doing things sometimes leads us into specificity conflicts.

Person at the beach thinking the about word semantics

Semantic Markup

The basic idea behind semantic markup is to reinforce the meaning of the content being marked up. For example if you want to include a quote, you’d use blockquote tags. You could use an ordinary paragraph and style the paragraph to look like a blockquote, but that carries less meaning. Similarly you wouldn’t wrap an ordinary paragraph in blockquote tags and then style the blockquote to look like a paragraph.

Semantic markup and classes are generally a good thing because:

  • They’re cleaner and clearer to read
  • They’re easier to maintain
  • They’re more accessible to devices
  • They’re more search engine friendly
  • They communicate more information

Does this mean we can never stray from semantic code?

Consider grid frameworks with classes like grid_7 and container_12. They aren’t semantic because they don’t describe the content. Instead they describe the presentation of the content. Still they can be a great benefit to designers in developing, reading and maintaining the code.

While I do think semantics are good and important I also think it’s ok to add some non-semantic code We don’t need to be 100% semantic at all times. Better is to understand how and where semantic elements can help in order to decide when and where to use them. We should strive toward semantic use of html without being a slave to it.

Rusty picture frame around a demolished building

Classitis

One way to avoid the specificity problem that comes with using descendent selectors is to use more classes, especially if you’re not against using markup that describes presentation.

For example you might create a generic frame class to serve as a frame around some images on your site. Those images get class=”frame” added and those meant to be seen sans frame won’t have the class. Right away this reduces specificity issues as we don’t have to write and overwrite css styles on different parts of the page.

Later you may decide that some frames will be more sleek and modern and others will be more decorative. The styes common to both can remain in the basic frame class while the styles differentiating each get their own modern and decorative classes.

 < img src="" alt="" class="frame modern" /> < img src="" alt="" class="frame decorative" /> 
 .frame {styles common to both;} .modern {styles for modern only;} .decorative {styles for decorative only;} 

In Nicole’s experience using classes in this fashion greatly reduces the amount of css we end up writing. This naturally plays out more the larger your site and css. On Facebook they were able to realize a 19% reduction in css (after gzip) and a 44% reduction in html (before gzip). You and I might not see the same results, but we’d likely see results.

There’s something very logical to using classes like this. We can create presentational objects that can easily be reused across a design. Again think of the grid systems or my frame example. At the same time there might be a downside in that we’re now coupling our html and css more.

Part of the idealized beauty of using css for presentation is the thought that with a few changes to a css file we can completely redesign everything on a site. If we’re adding all these extra classes does that cause problems? It would be hard to change a 12 column grid into a 16 column grid without changing the classes that were added through the html for example.

In practice though this idealized version of css doesn’t hold up. Some things we can easily change site wide by making a few css tweaks, including some layout changes. More often a complete redesign calls for structural changes to the html. Your 12 column grid doesn’t become a 16 column grid through css changes alone. It’s going to require html changes.

This doesn’t mean we should all go class crazy and use them for everything, but it does mean we don’t need to run away from using classes entirely. Somewhere in between there’s a good balance of using classes as presentational objects.

CSS written in blue on a black background

Summary

You may or may not agree with all or any of the above as flawed practices. Overall I tend to agree with what Nicole is suggesting and where her ideas lead, which is essentially to build sites with a reusable set of classes instead of sticking with descendent selectors.

I do have my reservations here and there. I don’t want to overdo the classes, but I do think a class-centric approach to html and css is generally a good one that allows for more design flexibility along with easier maintenance and a reduction in code.

I can see where it could lead to some difficulty if you’re looking to make wholesale changes as in a redesign, but more and more I think you’d encounter the same difficulty whether you’re using classes or descendent selectors and this probably isn’t a significant issue.

Mostly I think these ideas and questioning our practices makes a lot of sense, particularly now. The last year or two has seen so much new thinking in how we design and develop sites that now is the time to question much of what we hold as true and see if it still applies.

This rethinking leads us to some new concepts. As a reminder here are some topics I want to look at in the coming weeks.

  • abstracting css
  • oocss and smacss
  • css preprocessors

What do you think? Is Nicole right? Is it time to change some of our long held practices? Is there a danger in doing so?


Thursday 23 February 2012

What’s All The Fuss About Vendor Prefixes? | Van SEO Design

What’s All The Fuss About Vendor Prefixes? | Van SEO Design


What’s All The Fuss About Vendor Prefixes?

Posted: 23 Feb 2012 05:30 AM PST

You’ve probably seen talk the last couple of weeks about browser makers moving to adopt the -webkit prefix in their non-WebKit browsers. Mozilla appears to be leading this move and the response from the developer community has been to strongly suggest this as a very bad thing.

Collage of browser logos

The Issue

In a nutshell vendor prefixes exist to allow browsers and developers experiment with css properties like transitions that aren’t quite standardized yet. Each browser uses their own prefix, -webkit, -moz, -o, -ms, etc. and when we want to implement one of these properties we should use all these prefixes along with the non-prefixed version.

Through the above, browsers and standards bodies can see how everything is working and ideally the information helps finalize the spec at which point browsers and developers move to support the non-prefixed version only.

If we as developers have been doing things right we already have that non-prefixed version in our code and nothing breaks.

However all is not perfect.

  • Some vendor prefixed properties are not part of the spec.
  • Some are proprietary and may never find their way into the standards.
  • Some web developers are using these proprietary properties.
  • Some browsers feel the need to support these proprietary properties or be seen as less capable.
  • Some specs are often painfully slow to become standards.

The danger is that we find ourselves back in a time where sites list warnings like this site works best in browser x. Please update your browser.

What Can We Do?

I won’t pretend to understand every nuance of what’s at stake here. As a developer my main concern is I want to be able to transform an element here or animate something there and I just want to know how to do that and which browsers it will work in.

With that information I can make an informed choice about whether or not to use something and just as importantly where in the stack from “has to work” to “cool feature for those few who’ll be able to see it,” it should be added.

As developers we should do a better job of using vendor prefixed properties. We shouldn’t rely on them to the point of our sites breaking without them. We should lean toward not using proprietary features, except at the top of the progressively enhanced stack. And we should be better about using all vendor prefixes instead of just one or two.

Those of us who write about things like multi-columns and flexbox should be clearer about what is part of the working spec and what’s proprietary and not evangelize the proprietary as ready for use.

Vendors could dial back a bit on the proprietary stuff and drop support for prefixes once they are no longer needed. The W3C for it’s part could speed up its own process moving specs to the recommended stage.

We could all do something to help the situation.

W3C logo

Additional Resources

Again I won’t pretend to understand every nuance in this issue and it’s possible I’ve mischaracterized a few things above. I’m still trying to sort some of this out, but think it’s important enough to want to present the issue sooner rather than later.

Here then are some of the articles I’ve collected these past couple of weeks. They aren’t in any specific order other than the order they found me. A search for vendor prefixes will lead to plenty more.

Have you thought about this? How are you currently using vendor prefixed css? Any ideas for a workable solution?