Archive for the ‘HTML5’ Category

No Comments

CSS vendor prefix issues

Thursday, February 16th, 2012

Vendor prefixes are the verbose code you see in new `HTML5` sites, in which browser vendors test their new CSS3 rules, when specs are in proposal time or under development.

Something like:


-o-transition: opacity 1s ease-in 1s; //opera
-moz-transition: opacity 1s ease-in 1s; /firefox
-ms-transition: opacity 1s ease-in 1s; // internet explorer
-webkit-transition: opacity 1s ease-in 1s; // safari , chrome
-khtml-transition: opacity 1s ease-in 1s; // konquerer , linux
transition: opacity 1s ease-in 1s; // all when it's official spec

The problem is that most developers seem to do just this:

-webkit-transition: opacity 1s ease-in 1s; // safari , chrome

So they only support webkit browsers and that is plain dumb. At least you should always add the rule without any prefix. That means eventually it will work in every browser that supports it.
Typing all the rules is a pain in the ass, so most developers only do webkit, probably also because Apple invented quite a lot for transitions etc. At that time it was not supported by any other browser, so why on earth should you add code that has no meaning. Well because you care about the future and care about different minded people.

Two helpful solutions

First there are macro’s for IDE’s to type one rule and auto generate the other ones. Here is a CSS vendor prefix macro for Netbeans. Not much of a hassle.

Secondly you can call userJS to the rescue, userJS is like userCSS a rather underestimated part of the internet, but yet a very valuable one. It let you overrule CSS rules or run own JS in websites.

For Opera add this as a userJS:

opera.addEventListener('BeforeCSS', function(userJSEvent){
userJSEvent.cssText = userJSEvent.cssText
.replace(/-(moz|ms|webkit|o)-(border|text-overflow)/g,'$2')
.replace(/-(moz|ms|webkit)-(gradient|transform|transition)/g,'-o-$2');
}, false);

Source here

It will automatically rewrite all -webkit- rules to -o-  rules in Opera, so all the webkit  demo’s will start to work. (if Opera supports them)

Caveats

  • Code (css specs) can change during development.
  • Implementations differ between vendors.

Of course these are workarounds, I still think developers should add all vendor prefixes to their code. It can be automated in an IDE like with mentioned macro for Netbeans or in deployment.

1 Comment

Creating spinners with CSS transitions/transform and a bit of JS

Wednesday, June 1st, 2011

CSS3 can deliver animations without the help of javascript libraries. Less code, less server requests, so faster loading of your website.

Furthermore CSS will be hardware accelerated by the browser when possible. Not now, but in the near future. So it’s preferable to use CSS instead of javascript. Goodbye to jQuery UI?

We will see, since mobile web is really emerging we’re in the need of a better content/pagesize ratio. Less markup, less JS, less server request, and faster loading.

So a little example here. Compare it to the javascript driven various spinners out there on the internet.

No Comments

Google webfonts for everyday use?

Tuesday, October 19th, 2010

Let’s try some webfonts again from the Google Webfont api. Tangerine and Canterell. I like the webfont idea from Google. Read more about it on their blogpost.

This text is Tangerine

This text is Tangerine italic

This text is Tangerine bold

This text is Cantarell

This text is Cantarell italic

This text is Cantarell bold

A tad small compared to the default font. And Opera 10.63 renders all font-styles bold and italic as normal. Weird, for  the inventors of the webfont.

No Comments

The shadow of the invisible: AKA How to create fuzzy fonts with pure CSS

Thursday, October 7th, 2010

No, I wasn’t drunk writing this post, just had a long hot shower.

No, you don’t need new specs, this text is slightly blurred.

Scrubbing my back I was thinking about the new CSS3 stuff, and what you can do about spicing up the layout.

After my hot shower, steam filling my bathroom, I looked at myself in the mirror, razor-blade in hand to deliver a fast and clean shave.

Stop!

No shaving in the mist, no blood in the tub, but EUREKA
Fuzzy fonts with CSS!

How? (more…)

No Comments

Will Microsoft add SVG support to Internet Explorer in the near future?

Sunday, January 10th, 2010

Microsoft has applied to join the World Wide Web Consortium (W3C) Scalable Vector Graphics working group. I would say ten years to late, but they did it. So will all the examples on this site work in Explorer soon. I hope, but I fear not. Let’s explain that to you.

Animated SVG Logo Webonomic

One of the reasons I write critically about Microsoft is that they’re trying to slowdown internet innovation, probably best illustrated by the so called Embrace, extend and extinguish strategy, which had the purpose to extend open standards with proprietary capabilities, and then using those differences to disadvantage its competitors.

As a consequence, and another big reason I don’t like Microsoft, they push the time and costs of developing websites by approximately 40%. Simply because you have to write your JavaScript twice, can’t use modern CSS and lose a lot of time fixing lay-out bugs. That’s the price the world is paying for the Microsoft dominance in the browser market. Other estimations go about 20-30%, the well know Dutch developer PPK on quirksmode “Want a site that works perfectly in IE6? Fine, but it’ll cost you about 20 to 30% extra.”. (Costs of JavaScript libraries are excluded here).

I think Microsoft used that strategy and I think they were successful. Actually Microsoft stopped developing their browser form 2001 till 2007. Second thought: there is only one way that Microsoft will change that strategy, loss of market share. That didn’t really happen, at least not on a big scale, seems that most consumers don’t even know the word browser, Explorer worked out of the box, the blue e on your windows desktop was a synonym for internet, and Opera or Firefox a program for hackers or activists. Most sites used Activex, or other proprietary JavaScript, so a lot of sites didn’t work in Opera, actually they were designed (deliberately) to only work in Internet Explorer.

Now Google (and to a lesser extent Apple) entered the browser-market, things are starting to change. At least the web is gonna change: sites do not longer contain information, they contain applications.

And when you use web-applications, you don’t need them as a stand-alone program. That’s the danger for Microsoft. It’s not new, it has always been there and Microsoft knew. That’s why they made their browser `a critical part of their operating system`, technically nonsense, but they reached their goal. I took the EC a few years to refute that claim, a few years Microsoft made a lot of money.

Why didn’t Microsoft embrace SVG earlier. Well they developed Vector Markup Language (VML) during the nineties. That didn’t became a standard, so I guess they decided to stop doing anything for 5 years. Now Microsoft gained some substantial marketshare with Silverlight, a Flash/SVG comparable technology, which it’s used a lot for streaming Media lately, they probably think let’s join the SVG working group to – these are my wordssee if we can slowdown their activities.

Will we see SVG support in Explorer 9. I bet not!

UPDATE

I was totally wrong. There is SVG support in Explorer 9.

I can take my loss, it makes me happy to see Microsoft embrace webstandards 🙂

No Comments

HTML5 Webfonts woes: redefining standard fonts

Tuesday, September 29th, 2009

What happens if you redefine a standard font with a new html5 webfonts font-face css property?

Second question: is it case-sensitive?

Answer: as you could guess, it depends of the implementation of vendors. Defining standards is one thing, defining  error handling is a bigger and perhaps even more important challenge.

Here we gonna redefine the verdana font with the Pinewoord webfont, and define a Pinewood and a pinewood font based on different fonts:


<style scoped>
@font-face {
font-family: verdana;
src: url(http://dev.webonomic.nl/fonts/Pinewood.ttf);
}

@font-face {
src: url(http://dev.webonomic.nl/fonts/Pinewood.ttf);
font-family: 'pinewood';
}
@font-face {
src: url(http://dev.webonomic.nl/fonts/Pinocchio.ttf);
font-family: 'pinewood';
}

</style>

Paragraph with Verdana font

Nec tristique scelerisque, fringilla, cras eget proin. Fames, justo. Dui nisl ad nisi orci lectus curabitur scelerisque vitae. Metus tortor, scelerisque. Adipiscing tellus orci, magnis. Maecenas nullam. Eleifend. In, at enim habitasse dictum, lacinia, auctor.

Paragraph with Pinewood font

Nec tristique scelerisque, fringilla, cras eget proin. Fames, justo. Dui nisl ad nisi orci lectus curabitur scelerisque vitae. Metus tortor, scelerisque. Adipiscing tellus orci, magnis. Maecenas nullam. Eleifend. In, at enim habitasse dictum, lacinia, auctor.

Paragraph with pinewood font

Nec tristique scelerisque, fringilla, cras eget proin. Fames, justo. Dui nisl ad nisi orci lectus curabitur scelerisque vitae. Metus tortor, scelerisque. Adipiscing tellus orci, magnis. Maecenas nullam. Eleifend. In, at enim habitasse dictum, lacinia, auctor.

Firefox 3.5 and Safari 4.0 will redefine the Verdana font and render the Verdana and Pinewood font the same.

Opera 10 will stick to the standard font Verdana and will ignore the new definition.

All browsers treat the font-face case-insensitive, there are no differences in the rendering of both Pinewood paragraphs.

Chrome doesn’t render any webfonts in this example by default.
It should be started with the commandline switch: –enable-remote-fonts

I would say Opera’s behaviour is wrong:
Specs state:

If the font family name is the same as a font family available in a given user’s environment, it effectively hides the underlying font for documents that use the stylesheet. This permits a web author to freely choose font-family names without worrying about conflicts with font family names present in a given user’s environment.