VGTech is a blog where the developers and devops of Norways most visited website share code and tricks of the trade… Read more



Are you brilliant? We're hiring. Read more
the

CSS

category

Clean and simple Z-index with SASS lists

CSS

So.. Z-index. Ever used it on a rather large scale site before? Or in a CSS environment that you don’t really know inside out? What number did you set? Did you make it really, really high just to be sure? Ever used z-index: 100003? Or 99999999?

Highest z-index was an astonishing 999999999999999999999999999 or 9.99e26. With a default key repeat on OS X, this would take 3 seconds of holding down 9 to type.

QuickLefts 2014 CSS report

You don’t do that, right? Perhaps you rather build systems with levels set in hundreds or thousands, to be able to sneak in future elements? The oddball z-index: 1005; here and there?

For my latest project I used a rather simple trick in SASS that got me out of this potential mess, and I didn’t even set a single number. SASS took care of that for me! (more…)


Light introduction to Web Components

CSS

Web Components is a new set of HTML5 definitions that is currently only partially supported in the latest browsers. This article intends only to glance at the technology hoping that you might get a little insight into one of the biggest evolutional steps of future HTML development.

(more…)


Make your stuff look better – in 3 easy steps!

CSS

Many developers dread that final part of a project when they have coded up a brilliant piece of work and all that is left is making it look presentable. Unfortunately, it’s repeatedly proven that technical brilliance is easily overlooked unless it looks half decent and preferrably a bit unique. And while the trustworthy Twitter Bootstrap takes care of the first, it fails badly on the latter. Sometimes it might also be a bit superfluous to pull out an entire framework for a small piece of work.

So here’s a short, simple primer – in three simple steps – that can help you make your project look a bit more presentable without the need of an entire library.
(more…)


CSS: Block formatting context

CSS

Floats, absolutely positioned elements, block containers (such as inline-blocks, table cells, and table-captions) that are not block boxes, and block boxes with ‘overflow’ other than ‘visible’ (except when that value has been propagated to the viewport) establish new block formatting contexts for their contents.

~ W3C, CSS 2.1

Confusing? I at least thought so, but it’s actually quite simple when explained. The block formatting context is part of the visual CSS rendering of a web page. It affects the layout by changing how the contained elements float and clear. (more…)


Responsive CSS

CSS

The days when it was enough to create html stylesheets that work on one given screen width (eg 1024px) is over. As smartphones and tablets took the market, it was very common to have separate pages for such devices, like m.domain.com or touch.domain.com. Today, browsers are found on devices of all shapes and sizes. The transition between mobile and tablet is starting to blur, and soon browsers are found in both the television and the watch.
(more…)