Content
List titles within the list element
tysdag 29 juni 2010 - Filed under HTML5
Why don’t lists allow a list title child element? It makes perfect sense semantically, and it would save the extra wrapper <div> every time the designer needs to position a titled list.
Valid HTML, with the title separated from the list element:
<div class="mylist"> <h2>List title</h2> <ul> <li>Proin convallis fermentum leo, at elementum enim dapibus sed.</li> <li>Quisque dictum ligula massa, eget convallis tellus.</li> <li>Nulla et purus ut nisi cursus posuere nec pretium elit.</li> </ul> </div>
My suggestion, with a new list title child element:
<ul class="mylist"> <lt>List title</lt> <li>Nunc aliquam nunc quis turpis laoreet pretium.</li> <li>Aliquam et tortor quis massa rutrum commodo.</li> <li>Donec quis sapien ac justo fringilla fermentum cursus sit amet velit.</li> <li>Aliquam pulvinar rutrum nisi, a congue lacus blandit quis.</li> </ul>
Why not?
2 comments :: Share or discuss :: 2010-06-29 :: Asgeir
Custom radio inputs using pure CSS
onsdag 24 februar 2010 - Filed under CSS + Web design
Ryan Seddon, also referred to as the CSS Ninja, has created some impressive custom radio and checkbox inputs with pure CSS. The technique, which he posted late last week, is using some nifty selectors and pseudo-madness to detect input state, and swap the original inputs with images from a sprite.
The new inputs are actually attached to the label tag, rather than to the input itself, using the :before pseudo-class. The :hover, :focus, :active, and the :disabled classes are all used, in order to achieve full control over all possible states. So far, it looks like it degrades nicely in older browsers, falling back to the default inputs. It doesn’t require any additional markup, and it even lets you navigate the forms with the keyboard.
The only thing I noticed is that it seems like the bottom third or so of the checkbox doesn’t actually respond to a click, and the click zone stretches above the input correspondingly.
Have a look at the demo.
Well done!
:: Share or discuss :: 2010-02-24 :: Asgeir
DOM Scripting by Jeremy Keith
sundag 21 februar 2010 - Filed under Web design
I have been dabbling with Javascript a few times, but only at the level where I was stoked when I could create a function to convert fahrenheit to celsius. I was going to try to make a slightly more serious attempt at learning it, and bought DOM Scripting: Web Design with Javascript and the Document Object Model by Jeremy Keith of Clearleft.
Javascript has restored its name the last few years, after having lost all credibility as a serious tool due to browser wars, the DHTML disaster, pop-up dialogues and open-CD-tray scripts. Jeremy Keith sees javascript as a necessary scripting language that completes the front-end development toolkit, together with CSS and (X)HTML. Unobtrusive javascripting, unobtrusive being the keyword, offers an equal level of power to what CSS once did, when used correctly.
As for the target audience, this book was exactly what I was after:
The book is aimed at designers rather than programmers. If you’ve learned the benefits of Web Standards through CSS and you’re now ready to move on to the next level, this is the book for you.
DOM Scripting clearly introduces all the concepts that would be unfamiliar to a a non-programmer, and provides a solid history of the developments the last 10-or-so years, before diving into any scripting. Chapter two is a thorough explanation of the javascript syntax, with some half-practical examples. Next is the Document Object Model, and that’s where I’m at.
1 comment :: Share or discuss :: 2010-02-21 :: Asgeir
LESS: Generating grids and columns + LESS.app
måndag 15 februar 2010 - Filed under CSS + Web design
After more mocking around with LESS, I’m starting to see the possibilities that this framework presents. Defining constants (I do prefer the term constants over variables) in the beginning gives you an immense flexibility down the road. I’ve been experimenting with this little system that, based on a set of constants, defines the underlying grid for a very customisable layout. Have a look at the quick demo, or see the details below.
View the LESS (could be tidier..)
Defining values for your grid
@grid-margin: 20px; @grid-size: 60px + @grid-margin; @grid-stops: 12;
Depending on the kind of layout you are producing, and the size of it, these values will vary a lot. This is for a 12 column grid, at a total of 940 pixels.
A 12 column grid, as you’d know, is desirable because it can be divided into two, three, four and six columns.
Defining the width of your #page using the values
#page { width: @grid-size * @grid-stops - @grid-margin; }
…will output a width of 940px, because ((60+20) * 12) – 20 = 940 px
This will multiply your desired grid size (including margins) by the amount of stops, and subtract the last margin (because you don’t want a right margin at the right hand edge of your page.) Starting to see where this is going?
Defining columns
Using the same constants, you can easily define different column sizes.
.column-half {
width: @grid-size * @grid-stops / 2 - @grid-margin;
margin-right: @grid-margin;
}
.column-thirds {
width: @grid-size * @grid-stops / 3 - @grid-margin;
margin-right: @grid-margin;
}
.column-fourths {
width: @grid-size * @grid-stops / 4 - @grid-margin;
margin-right: @grid-margin;
}
.last {
margin-right: 0;
}
The .last class is necessary to remove the right margin from the last column, like you would do with any column based layout.
Again, have a look at this quick demo, where the @grid-size is 60px, and this one, where I changed the @grid-size is 50px.
Push/pull
You might be familiar with the push/pull classes from Blueprint, which use fixed pixel width values. You can easily do the same thing with LESS, using your variables.
.pull-1 { margin-left: - @grid-size; }
.pull-2 { margin-left: - (@grid-size * 2); }
.pull-3 { margin-left: - (@grid-size * 3); }
..etc
You could even use the CSS3 attribute selectors to select all the pull classes and add floats, instead of the endless string of classes that we’ve been doing so far.
div[class^="pull"] { float: left; position:relative; }
Working with LESS.app
I’m working with LESS in Espresso, running the LESS app on auto-compile in the background. Surprisingly, LESS.app is ignored over at LESScss.org (is it mentioned at all?) It is a great little tool that will scan any folder for .less files, add them to a graphical interface, and auto-compile them whenever you make a change. LESS.app was created by Bryan D K Jones, and even if you prefer using the command line («Command line junkies never get laid»), do check the website.
It is working perfectly, except for one thing: for some reason, Espresso doesn’t update the CSS when LESS compiles. Opening the file in CSSEdit or TextWrangler confirms that it is compiled, so it’s not an issue with LESS.app, but Espresso doesn’t seem to pick up on it. This isn’t really huge problem, but it does break the built-in preview in Espresso, and it makes it tedious to check what the CSS output looks like.
Either way, working LESS is a treat, the CSS output looks good, it is all valid, and the learning curve is slim to none if you’re already familiar with CSS.
:: Share or discuss :: 2010-02-15 :: Asgeir


I might be inactive, but sand maker is not!
måndag 19 april 2010 - Filed under General
The few times that I log in to this thing, I find myself enjoying the increasing amount of great comments. Sand maker thinks that the..
..as opposed to my good friend Daniel Depp, who is unhappy with my tone, and is yet to durchgerungen:
And, my other friend funny, knows where to get CSS classes on DVD:
1 comment :: Share or discuss :: 2010-04-19 :: Asgeir