Aleksandar • Vacić

iOS bits and pieces

On CSS, tables and layout

In short span of 2–3 days, I encountered two different examples of people writing that all this CSS–for–layout thing is nonsense. Too hard. Inadequate. Buggy and inconsistent. Just plain hard.

Well, it is. Hard, I mean.

Everyone knows how to build some shelter: put some stools and cover with branches and it would mostly fit the bill. If however it should withstand the wind and rain, it requires quite a bit more skills. Everyone knows how to get heating: put some wood and start a fire. Only few knows what it takes to build proper, natural heating that’s just there.

The same is with web development. Anyone can build a web page that looks fine to them. But it might not be fine to me or some other people. It might be downright inaccessible to some. It might be pain in the ass to some other.

Every single time I encounter rants like those two linked above, it’s plainly obvious it’s made by people who just don’t get it. I mean, just look at those two rants/posts (whatever you call them) and you’ll see how not-getting-it is the core of their frustration.

Just one example:

On the screen the natural order of flow for the five major layout elements is: top, left, center, right, bottom. But the actual order in which they appear in the code has “right” and “center” reversed. Is this a mistake? To find out, let’s see what happens if we change them around so that the order in the code matches the presentation order:

Youch! That looks terrible! Apparently the order matters. The reason that the order matters is that this layout, like all multi-column CSS layouts, is achieved with floats, and the way that floats get rendered depends on the order in which they appear. So we have not managed to separate content from presentation.

Yes Ron, it does not look good because CSS rules were written to achieve the desired layout using the given HTML structure code – which could also be much improved, but that’s another topic.

To give you real-life example: do you have a bike? Do you expect to be able to drive if you sit on it faced to the rear of the bike? Hm, crap, I can’t turn the pedals properly. The bike is shit.

The other rant is even worse, the anger of not being able to code the desired layout in CSS is spilling from all corners. I can understand that frustration and have experienced it several times, when I tried to learn something and failed to do so.

I drank the Kool-Aid, and I woke up two weeks later with a broken design. I had a headache from banging my head against the CSS wall. But, it simply couldn’t be a problem with CSS itself. The problem had to be that I didn’t understand CSS well enough. The answer had to be that I was bad, lazy or I didn’t care about web standards or something. The internets had told me so.

Yes iamelgringo, you’re just not up to it. You should have admitted it to yourself and hired someone else who is, to finish the job. Or just use tables as you did and get on with your life. Posting this:

So, I don’t ever want to read how web designers who don’t use pure CSS in their layouts are lazy, stupid, don’t care about their craft, backwards or don’t bathe properly. Never again. People who post such things online are heretofore to be known as CSS Trolls and are to be banished from the internets for all time. Begone yea vile fiends!

just makes you jealous wanker.

And just to touch lightly on the argument about Google - the fact that Google is not using CSS-based design is responsible for the fact that they have two different search pages - one for desktops, another for mobile devices (when I think about it, they probably have more than two). Multiple code bases for the page that has one input field and two buttons on it. Sheeeesh…Google’s front page is prime example of crapy front-end work.

Will code HTML for food. And give you crap code for it.

Or however that joke went. There are many reasons why tables are not to be used for layout. Two important ones are:

  1. tables are fixed structure which cement the layout for good

  2. cemented structures are impossible or way too hard to adapt to displays with vastly different screen estate

For instance, take a look at my winery web site. If you look at it on desktop browser, you’ll see rich graphics, 3-column web site. But if you look at it on iPhone in portrait mode, you’ll see one-column website with some graphics removed. All it took to achieve this look is one meta element in the page head and half a screen of additional CSS rules. It would be just as simple to adapt it to other mobile browsers. Let me see you do that this quick and fast with tables.

Not to mention how impossible is to achieve noticeably different skins if you use layout tables. For the last several years I have maintained old and created new instances of company’s main web product, using the very same code base, with just a different set of CSS rules and images. 20 or so counting, each new instance was several days at worst for the complete reskin job.

Every time I need to apply some designs to pages created using ASP.NET, I cringe and resign my case or dig deep and redo almost entire contents of the .aspx files. It takes good deal of knowledge to do things properly.

Not everyone are capable of doing it, which is just fine. There’s plenty of other professions, not everyone should be web front-end developers. If you don’t know how to do it and/or are incapable of learning, just give up and find some other thing to do in life.

Don’t go around prophesying nonsense.

IE8 beta2 considered harmful

I was notified that ADxMenu does not work in IE8 beta2. Apparently, it suffers from several CSS bugs that are triggered by my menu. Nothing to actually do about it, only hope that Microsoft developers will fix these soon.

These bugs are introduced in the beta2, as the menu was working fine with beta1. New IE engine’s growing hickups, I guess.

Update: Microsoft developers fixed this in IE8. My menu is working just fine there.

Better, more powerful Wordpress content management

First I started using categories as tags. Then got too many categories to be manageable. Then I converted them all to tags using converter from WP, which fucked up the categories. Then I got all those back to categories, which fucked up the tags.

I then tried to find a plugin that will help me deal with that mess and found none. There were few for older versions, but the ever changing WP internal structure that got more and more complex with each version forced those developers to give up.

So I did it manually. Deleted everything I did not want as category and thus ended up with 100+ posts in General category. Then one by one I assigned them to appropriate categories. Sucks, but it was the only thing that worked.

Does it really must be like this?

I did try to do it directly in the database. No way in hell. Posts are posts but are also pages. And maybe one more thing, not sure. Categories are not property of the posts or vice versa - instead they form a taxonomy. Which can be multiples for one cat/post pair. Each update is new taxonomy, you see. Really useful. And taxonomy is then one part of relationships table. The other part is object_id. Quite explanatory. You see object_id is …

Bah. I probably got half of the previous paragraph wrong. I can understand why no one wants to write a plugin that deals with that mess. I do hope Automattic has some sort of database re-factoring planned along the way. Otherwise this thing will self implode.

The best season ending ever

Last year, Lewis Hamilton fucked up 17pts lead in the last two races. This year, he had 7pts over Massa and up until 2 laps from the end he looked to be the champion.

Then Vettel passed him and Hamilton did not have any chance to catch him. No chance at all and I was watching in horror how McLaren was going to lose the title again, at the end. I was so horrified that I did not even see that both of them passed Glock two corners from the end. Glock stayed on dry tyres while the rain fell and he barely kept the car - he was 1:44 in the last lap to Hamilton’s 1:24. Gamble from Toyota team that nearly gave them 4th place. Gamble of Toyota team that nearly destroyed McLaren’s year.

Lewis Hamilton wins the title!

I don’t think there was ever a championship decider like this. Man, I still can’t believe what happened. Absolutely amazing, thrilling, fabulous.

McLaren has the Champion, after so many, many years that I lost count. It’s time to celebrate.