Chris Coyier zeigt im Smashing Magazine eine Lösung für folgende Frage:

Is it possible to create a list with CSS that has the text aligned to the right side, but on the left side has an image taking up the width of the remaining space?

Die Lösung (mit jQuery)

$(function(){
	$("li")
	 .wrapInner("<span></span>")
	 .prepend("<img src='images/listimage.png' />");
	var listWidth = $("li").width();
	$("li span").each(function(){
	 var itemWidth = $(this).width();
	 var imageWidth = listWidth - itemWidth;
	 $(this).parent().find("img").width(imageWidth - 10).height(1);
	});
});

Das Ergebnis ist hübsch. Ich meine ich habe etwas ähnliches in Bezug auf eine Speisekarte schon mal gebloggt, aber egal Wiederholung hilft besser zu werden ;-)

Possibly related posts (automatically generated)