mindgarden

.mindgarden is the digital playground of marc tobias kunisch

.opinions on this website are in not necessarily those of my employer

.send an email to info 'at' mindgarden 'dot' de

.follow the mindgarden on twitter @mindgarden_de or @tobestobs
.regular guest bloggers are @lwsrc, @dheeva and @idrathernot

Sep 22 2009 by tobs

Using CSS3 media queries to achieve multiple columns on browser resize

For the new mindgarden layout I’m using the CSS3 module called Multi-column layout in combination with Media Queries.

This means that if you have your browser at a relatively small size you are presented with one regular content column. If you resize you browser window to more than 1008px though this changes and the column is split into two. For window sizes wider than 1440px the content is split into three columns reminding a bit of a newspaper layout.

screenshot of the layout with two columns

the media query part

This is how the W3C spec (rather elaborately) describes media queries:

By using media queries, presentations can be tailored to a specific range of output devices without changing the content itself.

Sounds more complicated than it really is. Here’s the CSS that I’m using for my layout:

Firstly I’m setting my default styling for my element.

.entry-content { ... }

Nothing unusual or surprising here. But then I want to specify some styling for larger window sizes.

@media all and (min-width: 70em) { .entry-content {... } }

I’m using “@media all” as I want to apply my rules to all output devices (screen, print, etc.). The min-width part is used so it only effects windows that have a minimum width of 70em.

Then I’m doing the same again for even larger windows.

@media all and (min-width: 100em) { .entry-content { ... }}

multi columns

So far so good. Now we have the means to differentiate between different browser sizes. Let’s use this to do some column-magic. Let’s add some style rules:

.entry-content {
font-size: 1.2em;
line-height: 1.8em;
color: #444;
}

Again, no surprises. Alas, here come the columns:

@media all and (min-width: 70em) {
.entry-content {
-moz-column-count: 2;
-moz-column-gap: 4em;
-webkit-column-count: 2;
-webkit-column-gap: 4em;
}}

First of all, notice the namespaces used for Firefox and Safari. CSS3 is not a finished standard yet and for the time being this is how browser manufacturers like to implement CSS3 features. If Opera supported the multi-column module there would be something like “-o-column” as well. Unfortunately this feature hasn’t made it into Opera 10.

Creating our columns is quite simple. column-count marks the number of columns specified and column-cap the with of the spacing between them. The available space is distributed accordingly. Notice how the copy text flows from one column to the next when you resize this browser window.

I could have uses column-width instead to get a fixed with for my columns. Then the browser would have generated the number columns for me. There’s also column-rule which I haven’t used. With column-rule you can create a border in between you columns.

@media all and (min-width: 100em) {
.entry-content {
-moz-column-count: 3;
-webkit-column-count: 3;
}}

For really large window sizes I’m adding another column here. I don’t have to repeat my rules for the column-gap because if my window is wider than 100em, it is also wider than 70em and those rules get inherited.

Done!

Safari cutting off the images

Unfortunately, Safari isn’t playing along entirely with my cutting-edge-css3-goodness-showcase. Browsers that don’t understand media queries or multi-columns will just degrade gracefully and show the one default column. Safari on the other hand will display the columns just fine as long as you don’t use images or embedded flash content.

If you use images or flash in your columns Safari sometimes has the nasty habit of cutting them in the middle and showing one slice in one column, the other in a second.

example of a sliced flash movie

There’s already a ticket created for this in the webkit ticketing system So far I couldn’t a workaround for this so let’s hope it will get fixed soon.

No support for column-span

A good way to prevent the Safari bug from happening would be to use column-span that is part of the CSS3 spec. Similar to col-span for tables column-span would make it possible to say for example

h2 { column-span: all; background: silver }

example for column-span
(example from the W3C document)

Unfortunately column-span is not supported in any browser yet.

Sep 18 2009 by tobs

I've seen Tim Berners-Lee...

...and so can you.

Last week I went to see Tim Berners-Lee speak about the past and the future of the web at the London Science Museum. Although there wasn’t much in his talk that would be new or surprising it was still a very inspiring presentation. After all he is the guy who invented the web.

Although there is no recording of last weeks presentation (that I’m aware of) he did give a very similar one at the TED copnference. And that means you can watch it too:

Sep 16 2009 by tobs

Real-time mindgarden with Feedburner and PubSubHubbub

With the new mindgarden we also started using Feedburner to get a better idea how many people are reading our feeds.

pubsubhubbub logo

Feedburner comes with a service called PingShot and Google (who own Feedburner) have recently connected PingShot to a brand new hot thing called PubSubHubbub. PubSubHubbub, next to RSSCloud which basically does the same but different, is quite the hype recently. It was created to make RSS part of the Real Time Web. Meaning that your RSS feed is no longer passive but gets pushes to a hub which then along with all the contents of your feed pushes it on to subscribed clients (if they are capable of receiving pushed feeds).

So if you’re already using Feedburner, you can simply activate PingShot and make use of PubSubHubbub yourself.

If you want to know more about PubSubHubbub Pubsubhubbub: Feed-Push für Alle (German) does a good job in explaining the whole thing in a lot more detail.

Sep 15 2009 by flo

Märchengeschichten

flo: ich post gleich mal was
tobs: hehe mach mal
flo: irgendeinen lustigen trickfilm
kennst du youtue?
tobs: nee, das ist langweilig
flo: youtube?
tobs: neee
flo: ist eigentlich ne ganz coole seite
die haben so videos online
tobs: wie? im internet?
flo: ja. hammer oder
tobs: ab-ge-fahren
flo: hier der link:
http://www.youtube.com
da gibts auch so ein rating
tobs: was ist denn ein link?
flo: versuch mal drauf zu klicken
tobs: wie geht das denn nu wieder?
flo: muss drüber und klicken
hast du eine maus bei dir?
tobs: haha, sehr witzig
hier isses ordentlich
kein ungeziefer


(via datenvandalen)

← Previous  1 … 5 6 7 8 9 … 176 Next →