<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pixelbox &#187; CSS</title>
	<atom:link href="http://www.pixelbox.net/category/development/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pixelbox.net</link>
	<description>Pixelbox, technology development and photography.</description>
	<lastBuildDate>Thu, 08 Apr 2010 16:35:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Interview questions to ask a front end developer</title>
		<link>http://www.pixelbox.net/2008/01/09/interview-questions-to-ask-a-front-end-developer/</link>
		<comments>http://www.pixelbox.net/2008/01/09/interview-questions-to-ask-a-front-end-developer/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 12:28:51 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Hijax]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2008/01/09/interview-questions-to-ask-a-front-end-developer/</guid>
		<description><![CDATA[This-morning I had to quickly run up some questions for someone&#8217;s second interview. We were looking for someone with good front end knowledge, so I knocked up some questions to ask them. I found these were very good at getting them talking, and gave them a lot of potential to show they had a strong [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.pixelbox.net/wp-content/uploads/2008/01/814457_business_card_3.thumbnail.jpg' alt='Interview' />
<p>
This-morning I had to quickly run up some questions for someone&#8217;s second interview. We were looking for someone with good front end knowledge, so I knocked up some questions to ask them. I found these were very good at getting them talking, and gave them a lot of potential to show they had a strong knowledge in the field.
</p>
<p>Let me know if you think there are some other good questions that will provoke some good discussions!</p>
<h3>HTML Questions</h3>
<ul>
<li>What is a doctype?</li>
<li>What different versions of HTML are there, what&#8217;s the difference between transitional and strict?</li>
<li>What do you know about HTML 5, and do you think you will use it?</li>
<li>What are the advantages and disadvantages of using web standards.</li>
<li>Do you know what the trinity of web standards are? (Separation of, structure, behavior and presentation)</li>
<li>What is the concept behind the semantic web, and why does it matter?</li>
<li>Do you know what micro formats are?</li>
<li>What related blogs or websites to you read?</li>
</ul>
<h3>Accessibility Questions</h3>
<ul>
<li>What is accessibility and why does it matter?</li>
<li>What should you put in alt text for presentational images?</li>
<li>Why are, &#8220;click here&#8221; links bad to use?</li>
<li>Why do people use skip to content and skip to navigation links?</li>
<li>How can CSS aid accessibility?</li>
<li>How can you test for accessibility compliancy? Why do automated tests not guaranty accessibility.</li>
<li>What related blogs or websites to you read?</li>
</ul>
<h3>CSS Questions</h3>
<ul>
<li>What is the difference between using inline CSS and using an external CSS file. When would you use inline CSS?</li>
<li>What browser do you develop in?</li>
<li>What browsers do you test in?</li>
<li>What is the ACID2 test?</li>
<li>Who or what is WASP?</li>
<li>What are CSS hacks and what are they used for?</li>
<li>What related blogs or websites to you read?</li>
</ul>
<h3>SEO Questions</h3>
<ul>
<li>What would you said the main 4 search engines are?</li>
<li>What would you say the most important element in the head of an HTML document are?</li>
<li>What would you say the most important element in the body of an HTML document are?</li>
<li>How do search engines treat content inside an IFrame?</li>
<li>How can you convey information in an image to a search engine.</li>
<li>How can you convey information in a flash movie to a search engine.</li>
<li>What is keyword stuffing?</li>
<li>What is cloning?</li>
<li>How should you re-direct traffic from http://pixelbox.net to http://www.pixelbox.net ?</li>
<li>What related blogs or websites to you read?</li>
</ul>
<h3>JavaScript Questions</h3>
<ul>
<li>What is ECMAScript?</li>
<li>What is the DOM?</li>
<li>What is unobtrusive JavaScript? Why is it important? What is HIJAX</li>
<li>How would you add a JavaScript event to a link or button, and why?</li>
<li>What are the advantages and disadvantages of Frameworks?</li>
<li>What would you do if a framework could not provide the functionality you needed?</li>
<li>What frameworks have you used and why did you choose it?</li>
<li>What is browser sniffing and where would you use it? (trick question&#8230; never!)</li>
<li>What is Comet? What sites use it?</li>
<li>What is JSON? Why would you use JSON over XML?</li>
<li>What sites do you think use JavaScript well?</li>
<li>What industry blogs do you read?</li>
<li>How do you debug JavaScript</li>
<li>What problems have you had with IE when DOM scripting and how have you overcome them?</li>
<li>What related blogs or websites to you read?</li>
</ul>
<h3>Tools Questions</h3>
<ul>
<li>What software do you use to develop in and why?</li>
<li>What are the advantages and disadvantages of using WYSIWYG development tools?</li>
<li>What browser do you use to develop in and why?</li>
<li>What browser do you use on a daily basis, and why?</li>
<li>What is any, plugins or bookmarklets do you use?</li>
<li>What browsers do you test you work in?</li>
<li>What operating systems do you test your work in?</li>
<li>Do you use source control, if so what, if not why not?</li>
<li>Do you develop locally or on a remote server?</li>
<li>Do you know how to set up a web server, apache, MySQL etc</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2008/01/09/interview-questions-to-ask-a-front-end-developer/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Vertical center in CSS</title>
		<link>http://www.pixelbox.net/2007/09/04/vertical-center-in-css/</link>
		<comments>http://www.pixelbox.net/2007/09/04/vertical-center-in-css/#comments</comments>
		<pubDate>Tue, 04 Sep 2007 16:28:16 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2007/09/04/vertical-center-in-css/</guid>
		<description><![CDATA[Yesterday a collogue asked me about vertically centering (centring) a div in CSS. Vertical align in CSS does not seem to be able to solve this too well, and I had previously assumed that the only way to achieve the desired effect was to use JavaScript to get the window height and then subtract half [...]]]></description>
			<content:encoded><![CDATA[<p>
Yesterday a collogue asked me about vertically centering (centring) a div in CSS. Vertical align in CSS does not seem to be able to solve this <a href="http://www.w3.org/Style/Examples/007/center.html#vertical">too well</a>, and I had previously assumed that the only way to achieve the desired effect was to use JavaScript to get the window height and then subtract half the height of the element you want to center.
</p>
<p>
This isn&#8217;t great and seems a little bit hacky. So I did some research and found a couple of solutions (<a href="http://www.hicksdesign.co.uk/journal/how-to-vertical-centering-with-css">solution one</a>, <a href="http://d-graff.de/fricca/center.html">solution two</a>). These have been around for a long time, I guess I must have just missed them?!
</p>
<p>
These both work, although the second is slightly more solid than the first. In at attempt to understand them further I made a demo page or each method, which should explain how they work.
</p>
<h3>Absolute positioned div</h3>
<p>
The first example based on Hicksdesign&#8217;s solution uses a div positioned 50% down the page with a negative bottom margin, set to half the height of the element you want to center. The second uses the same technique but with only one element.
</p>
<p>
The problem with both these methods is that content is lost at the top of the element if you make the browser window too small.
</p>
<p><a href="http://www.pixelbox.net/demos/cssVerticalCenter/absolute_positioning.html">Absolute positioned div method</a><br /> <a href="http://www.pixelbox.net/demos/cssVerticalCenter/absolute_positioning2.html">Absolute positioned div method 2</a></p>
<h3>Spacer div</h3>
<p>
This example based on d-graff&#8217;s idea uses a floated div with a height of 50% and again a negative bottom margin, set to half the height of the element you want to center. The content is then set to clear the floated element.
</p>
<p>
This seems to be more solid as it works nicely with scroll bars.
</p>
<p>
<a href="http://www.pixelbox.net/demos/cssVerticalCenter/spacer_div.html">Spacer div method</a>
</p>
<p>
One problem with both these methods is that the content in the centered div has to be known and set by the CSS. In order to have higher(taller) content you will have to use <a href="http://www.w3schools.com/css/pr_pos_overflow.asp">overflow auto</a> (as in the examples). Or use JavaScript to mod the height in your CSS/HTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2007/09/04/vertical-center-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google adds themes to Personalized Home</title>
		<link>http://www.pixelbox.net/2007/04/04/google-adds-themes-to-personalized-home/</link>
		<comments>http://www.pixelbox.net/2007/04/04/google-adds-themes-to-personalized-home/#comments</comments>
		<pubDate>Wed, 04 Apr 2007 15:34:12 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2007/04/04/google-adds-themes-to-personalized-home/</guid>
		<description><![CDATA[A long time ago now, before he got sucked into Apple (and recently Yahoo it seems) a young man called Dunstan Orchard implemented a banner image in his blog that changed with the weather conditions of where it was taken (a photo of his parents house). Today I noticed that Google have also implemented this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flickr.com/photos/77646648@N00/446156060" title="Google's new personal home page theme"><img src="http://static.flickr.com/163/446156060_236622cb43_m.jpg" border="0" /></a>A long time ago now, before he got sucked into Apple (and recently Yahoo it seems) a young man called <a href="http://www.1976design.com/">Dunstan Orchard</a> implemented a <a href="http://www.1976design.com/blog/">banner image</a> in his blog that changed with the weather conditions of where it was taken (a photo of his parents house).</p>
<p>Today I noticed that <a href="http://www.google.co.uk">Google</a> have also implemented this feature as part of one of the themes on the <a href="http://www.google.com/ig?hl=en">google personalized home page</a>. The theme selector seems to only be on the .com url for the moment but the weather changes with the postcode you enter.</p>
<p>It&#8217;s kind of cool, and it&#8217;s nice to see google moving forward with the personalized home page, which I think is great, mainly for my links (cross browser) and my <a href="http://www.digg.com">Digg</a> top 10.</p>
<p>Check it out and let me know what you think</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2007/04/04/google-adds-themes-to-personalized-home/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CSS Mastery iPod Giveaway</title>
		<link>http://www.pixelbox.net/2006/12/20/css-mastery-advanced-web-standards-solutions/</link>
		<comments>http://www.pixelbox.net/2006/12/20/css-mastery-advanced-web-standards-solutions/#comments</comments>
		<pubDate>Wed, 20 Dec 2006 20:33:17 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2006/12/20/css-mastery-advanced-web-standards-solutions/</guid>
		<description><![CDATA[Dear Santa, I recently came across a post on Andy&#8217;s website suggesting I should write you a letter to ask for a copy of the book, CSS Mastery for Christmas. Not knowing much about the book I decided to do a little research and discover if I really did want it&#8230; The book is entitled [...]]]></description>
			<content:encoded><![CDATA[<p><a title="CSS Mastery: Advanced Web Standards Solutions" href="http://flickr.com/photos/77646648@N00/328413733"><img border="0" src="http://static.flickr.com/142/328413733_32c51526be_m.jpg" /></a>Dear Santa,</p>
<p>I recently came across a post on <a title="Andy Budd" href="http://www.andybudd.com/">Andy&#8217;s website</a> suggesting I should write you a letter to ask for a copy of the book, <a title="CSS Mastery" href="http://www.cssmastery.com/">CSS Mastery</a> for Christmas.</p>
<p>Not knowing much about the book I decided to do a little research and discover if I really did want it&#8230;</p>
<p>The book is entitled <a title="Become a CSS Pro" href="http://www.cssmastery.com/">CSS Mastery: Advanced Web Standards Solutions</a>, from which I assume it takes developers through the best practices in order to developer websites that are valid, accessiable and up to the W3C&#8217;s standards.</p>
<p>I personally wrote my dissertation on the subject of developing with web standards and interviewed <a title="Andy Budd" href="http://www.andybudd.com/">Andy</a> during the process, so would be fascinated to see how he tackles the subject.</p>
<p>I am currently doing a lot of front end work on a very large website due to launch in the new year. I believe I have tackled it in the best way, and used many techniques I learnt through Zeldman, Cederholm, Clark and Keith books. So have another frame of reference would be fantastic.</p>
<p>The book starts by setting the foundations for front-end web development. This is something thats importance I can&#8217;t stress enough. Even now I am still getting to grips with how the flow works and the more I understand the less I feel the distant urge to sod it and hack away with tables and spacer gifs. So when I saw the second chapter was about the visual formatting model I was even more excited. From having previously meet Andy I&#8217;m sure the book will also cover the trinity of web standards, something I am deeply passionate about.</p>
<p>Latter sections of CSS Mastery cover hacks and bug fixes, which I assume will help developers support browsers that are not as CSS compliant, such as Internet Explorer. This again is something that I often see tipping developers over the edge and resorting to hacky and browser spercific methods.<br />
I also spotted that the book also has two case studies, <a title="A great example of CSS Mastery" href="http://doodles.cssmastery.com/">More Than Doodles</a> and <a title="Another great example of what can be achieved with CSS Mastery" href="http://tuscany.cssmastery.com/">Tuscany Luxury Resorts</a>. The first thing you notice is that both of these sites look fantastic, and have lots of modern web design styles and techniques that I would love to learn more about. They also look like full sites, rather than those small, rushed and often rather ugly sites you get with most other CSS books.</p>
<p>Andy was helped with the book by Cameron Moll and Simon Collison, both some what web development celebrities, whose names I&#8217;m sure you have heard before and can only add quality to the book. The book is also publised by Friends of ED, who have also published one of my faviourite development books by Jeremy Keith on DOM Scripting.</p>
<p>A great looking sample chapter of the book can be downloaded from the webiste <a href="http://www.cssmastery.com/CSSMastery-Chapter7.pdf">CSS Mastery: Chapter 7 Layout</a>. You can also get the examples used in the book and view the example sites.</p>
<p>So in conclusion it looks like a great book, so if your still doing your shopping santa, I hope I can give you a hint. (You can even <a title="Get your copy of the great CSS Mastery from Amazon" href="http://www.amazon.co.uk/exec/obidos/redirect?link_code=as2&#038;path=ASIN/1590596145&#038;tag=blogography-21&#038;camp=1634&#038;creative=6738">get CSS Mastery from amazon</a> so you dont have to leave the house ;) )</p>
<p>Thanks, Rob</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2006/12/20/css-mastery-advanced-web-standards-solutions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Problems with setAttribute in IE</title>
		<link>http://www.pixelbox.net/2006/11/13/problems-with-setattribute-in-ie/</link>
		<comments>http://www.pixelbox.net/2006/11/13/problems-with-setattribute-in-ie/#comments</comments>
		<pubDate>Mon, 13 Nov 2006 11:43:55 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hijax]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2006/11/13/problems-with-setattribute-in-ie/</guid>
		<description><![CDATA[Whilst being Pr0 and trying to work around IE&#8217;s inability to understand the CSS :after class I used JavaScript to add a clearing element after the classes through the DOM, but only for IE. (I know browser sniffing is wrong but if it adds in a clearing element in Opera too there won&#8217;t be any [...]]]></description>
			<content:encoded><![CDATA[<p>
Whilst being Pr0 and trying to work around IE&#8217;s inability to understand the CSS :after class I used JavaScript to add a clearing element after the classes through the DOM, but only for IE. (I know browser sniffing is wrong but if it adds in a clearing element in Opera too there won&#8217;t be any ill effect).
</p>
<p>
Anyway I found that Internet Explorer can&#8217;t add style content through setAttribute and also can&#8217;t seem to set the class name and then apply the class from the CSS.
</p>
<p>
After a bit of digging on the web I found that you can use setAttribute(&#8220;className&#8221;,&#8221;clearAll&#8221;); to do the same in IE. This works fine but be sure to remember that if Opera or Camino are pretending to be IE they wont add the class name through className so it&#8217;s worth adding a class in too, just as a back up. (Why can&#8217;t browsers pretending to be IE not have another navigator element saying their true identity)
</p>
<p>
Thanks to <a href="http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html">quirksmode</a>
</p>
<p> for the info on this!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2006/11/13/problems-with-setattribute-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Truncating HTML elements through the DOM</title>
		<link>http://www.pixelbox.net/2006/11/08/truncating-html-elements-through-the-dom/</link>
		<comments>http://www.pixelbox.net/2006/11/08/truncating-html-elements-through-the-dom/#comments</comments>
		<pubDate>Wed, 08 Nov 2006 15:55:56 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Hijax]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2006/11/08/truncating-html-elements-through-the-dom/</guid>
		<description><![CDATA[After the launch of Monkey I have had time to (been forced to) do some other projects. Whilst being a nice change it&#8217;s also rather annoying not getting to polish something once you have got the first release out. However needs must and hopefully I will be back on it soon. Being back on the [...]]]></description>
			<content:encoded><![CDATA[<p>
After the launch of Monkey I have had time to (been forced to) do some other projects. Whilst being a nice change it&#8217;s also rather annoying not getting to polish something once you have got the first release out. However needs must and hopefully I will be back on it soon.
</p>
<p>
Being back on the front end train I have strived to gets some things perfect and armed with my new love for the DOM and Hijax I have started to seen new potential solutions to problems.
</p>
<p>
The one I had today was a design issue where by an ordered list on a website had the potential to contain an item that would wrap onto more than one line. Consequently breaking the nice look and feel of a page.
</p>
<p>
I found my self with potentially three options to solve this problem.
</p>
<ol>
<li>Do it back end in the CMS</li>
<li>Use CSS to limit it&#8217;s width</li>
<li>Use DOM Scripting to truncate the node content</li>
</ol>
<p>
Doing it in the back was a bad idea. Firstly its more work in the back end which is already overflowing with work and secondly we would loose content for something which is related to a front end style.
</p>
<p>
Therefore I decided to go front end on it and had to choose between CSS and JavaScript to perform the truncation of my text.
</p>
<p>
CSS has the advantage of speed over JavaScript, mainly because you need to wait for the DOM to load before you can edit it meaning that you could potentially see the content disappear before your very eyes.
</p>
<p>
With CSS we can set the list item in the ordered list to have a set width and no visible overflow. This works well but has no evidence that something has been truncated, and may lead to bad results. Also when you supply overflow: hidden; to a list item in an ordered list the item number is hidden&#8230; great! However my list items needed to be links, giving me an anchor tag to apply the overflow:hidden to.
</p>
<p>
The next problem was to add the &#8230; onto the end of the truncated item. This can be done with the CSS pseudo-element :after which can add in content. However there is no way to apply logic to say only apply the content if it has an overflow.
</p>
<p>
So the next way to do it was with JavaScript and the DOM, the advantage here was you could apply the changed with logic. You can vary the max size on elements through HTML attributes, apply truncation only when needed, move the full version into another element and if it doesn&#8217;t work you can still use the CSS to back you up.
</p>
<p><code></p>
<p>function maxLen() {<br />
    var toTruncate = new Array();<br />
    var toTruncate = getElementsByClassName( document, "*", "truncate" );<br />
    var length;<br />
    var truncated;<br />
    var content;<br />
    for( var i=0; i < toTruncate.length; i++ ){<br />
        length = toTruncate[i].getAttribute('title');<br />
        toTruncate[i].setAttribute('title','');<br />
        if(toTruncate[i].firstChild.nodeType == 3){<br />
            content = toTruncate[i].firstChild.nodeValue;<br />
            if( content.length > length ){<br />
                truncated = content.substr(0,length);<br />
                toTruncate[i].firstChild.nodeValue = truncated+"...";<br />
                toTruncate[i].setAttribute('title',content);<br />
            }<br />
        }</p>
<p>    }<br />
}</p>
<p></code></p>
<p>
Here I used a construct function to call my script on page load, and also used a method to get elements by class name, there are lots on the web you can use!
</p>
<p>
Let me know what you think or if you have any other options!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2006/11/08/truncating-html-elements-through-the-dom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clearing &#8220;the above&#8221; element in CSS</title>
		<link>http://www.pixelbox.net/2006/10/10/clearing-the-above-element-in-css/</link>
		<comments>http://www.pixelbox.net/2006/10/10/clearing-the-above-element-in-css/#comments</comments>
		<pubDate>Tue, 10 Oct 2006 10:23:05 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2006/10/10/clearing-the-above-element-in-css/</guid>
		<description><![CDATA[A problem I often have with CSS and forms is clearing elements that are floating. A lot of the time I will create a definition list to deal with form elements. If I then want them to all line up (radio buttons for example) I need to float the radio buttons and their lables to [...]]]></description>
			<content:encoded><![CDATA[<p>
A problem I often have with CSS and forms is clearing elements that are floating. A lot of the time I will create a definition list to deal with form elements. If I then want them to all line up (radio buttons for example) I need to float the radio buttons and their lables to the left, and then apply clear left to the lables so each one is on a new line. The result is like so:
</p>
<p><a title="Definition lists in forms" href="http://flickr.com/photos/77646648@N00/265911157" ><img src="http://static.flickr.com/89/265911157_21dfe92788_d.jpg" border="0"/></a></p>
<p>
The problem with this is that the Definition list its self has no height, and anything after it won&#8217;t be able to see it&#8217;s floating content. The result is as follows:
</p>
<p><a title="Problems with floating" href="http://flickr.com/photos/77646648@N00/265912464" ><img src="http://static.flickr.com/101/265912464_81b3ccd808_m.jpg" border="0"/></a></p>
<p>
This can be easily fixed by making anything directly following it a clear:left property. The problem with this is, it&#8217;s very hard to give the same margin below your element, apart from spercifically adding padding or margin to the element below.
</p>
<p>
In the past I have gotten arround this by adding in paragraph into the HTML with a clear:both property. This gives a solid element below all our floats that any following element can see, resulting in correct margins once again.
</p>
<p>
This is great but it means adding styling though HTML and meaningless content. Not great and useless if you change your design or are viewing in a browser that can&#8217;t use CSS.
</p>
<p>
The answer to this problem came to me through <a href="http://www.positioniseverything.net/easyclearing.html" title="read more on it here">Position is everything&#8217;s: How To Clear Floats Without Structural Markup</a>. By using the CSS 2 property: <strong>after:</strong> you can add content and then make that conent clear anything above it. Replacing my presentational HTML.
</p>
<pre>
<code>
.dl:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
</code>
</pre>
<p>
I changed the &#8220;full stop&#8221; to a space and it seems to work fine. There are also some little hacks to make it work in old IE too :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2006/10/10/clearing-the-above-element-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hijax and Behavioural Separation</title>
		<link>http://www.pixelbox.net/2006/09/28/hijax/</link>
		<comments>http://www.pixelbox.net/2006/09/28/hijax/#comments</comments>
		<pubDate>Thu, 28 Sep 2006 13:44:58 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2006/09/28/hijax/</guid>
		<description><![CDATA[The more I have been getting into using JavaScript the more I have seen the benefits of using Behavioural Separation. The concept is simple, separate your behaviour from your structure/content just as you do your style (spaghetti code is bad people!). Although at first it seems much harder to use the DOM to apply listeners [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/robmcm/254858541/" title="Photo Sharing"><img src="http://static.flickr.com/108/254858541_32b89aa8fa_m.jpg" width="240" height="75" alt="behaviorhttp://alistapart.com/articles/behavioralseparation" /></a></p>
<p>
The more I have been getting into using JavaScript the more I have seen the benefits of using <a href="http://alistapart.com/articles/behavioralseparation">Behavioural Separation</a>. The concept is simple, separate your behaviour from your structure/content just as you do your style (spaghetti code is bad people!).
</p>
<p>
Although at first it seems much harder to use the DOM to apply listeners to buttons and links, after a bit more development you have the fantastic advantage of having all your code in one place and the ability to re-use it across your site.
</p>
<p>
This has lead me onto using Hijax, <a href="http://alistapart.com/authors/k/jeremykeith">Jeremy Keith</a>&#8216;s buzz word for graceful degradation of Javascript and of-course AJAX. The concept is simple:
</p>
<ol>
<li>First, build an old-fashioned website that uses hyperlinks and forms to pass information to the server. The server returns whole new pages with each request.</li>
<li>Now, use JavaScript to intercept those links and form submissions and pass the information via XMLHttpRequest instead. You can then select which parts of the page need to be updated instead of updating the whole page.</li>
</ol>
<p>
You now have an application that can&#8217;t fail. If you have a user with a browser that can&#8217;t use JavaScript (a mobile phone for example) or a user that has turned it off (because JavaScript is often used to harass users) the site performs normally. If they have a compatible browser they get super buzz worded version of your site. You also have the added benefit that any bugs in your JavaScript won&#8217;t fail your site as if the JavaScript stops working so does the &#8221; return: false; &#8221; on your links meaning they are followed as normal.
</p>
<p>
The result is a super stable web app, that is extremely easy to manage and maintain.
</p>
<p><a href="http://domscripting.com/blog/display/41">For more information on Hijax, click here</a>, and <a href="http://alistapart.com/articles/behavioralseparation">click here for more information on Behavioural Separation</a>. You can also <a href="http://adactio.com/">find out more about Jeremy Keith and his book, DOM Scripting here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2006/09/28/hijax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Global white space reset</title>
		<link>http://www.pixelbox.net/2006/09/14/css-global-white-space-reset/</link>
		<comments>http://www.pixelbox.net/2006/09/14/css-global-white-space-reset/#comments</comments>
		<pubDate>Thu, 14 Sep 2006 16:05:27 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.pixelbox.net/2006/09/14/css-global-white-space-reset/</guid>
		<description><![CDATA[*Overview:* All browsers have minor differences in padding and margins applied to elements. Therefore it is often easier to reset these values so all elements look the same on all browsers and then apply them later as and when you need them! In the most basic form you can just add this to the top [...]]]></description>
			<content:encoded><![CDATA[<p>*Overview:*<br />
All browsers have minor differences in padding and margins applied to elements. Therefore it is often easier to reset these values so all elements look the same on all browsers and then apply them later as and when you need them!</p>
<p>In the most basic form you can just add this to the top of your CSS page</p>
<pre><code>
    * {
    padding:0;
    margin:0;
    }
</code></pre>
<p>But this then leaves you a bit stuck with some elements which need padding and margins (especially form elements!)</p>
<p>So in order to reset a few values so they all pretty normal (but importantly the same in all browsers!) add this too:</p>
<pre><code>

    * {
    padding:0;
    margin:0;
    }
    h1, h2, h3, h4, h5, h6, p, pre, blockquote, label, ul, ol, dl, fieldset, address { margin:1em 5%; }
    li, dd { margin-left:5%; }
    fieldset { padding: .5em; }

</code></pre>
<p>For more info on this check this site out (where I nicked the code from!)</p>
<p><a href="http://leftjustified.net/journal/2004/10/19/global-ws-reset/">http://leftjustified.net/journal/2004/10/19/global-ws-reset/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelbox.net/2006/09/14/css-global-white-space-reset/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
