There is a really great screencast available at Nettuts+ which demonstrates how you can 'make all browsers render HTML5 mark-up correctly.' It is a really simple trick that allows you to apply CSS for HTML5 elements.
To quickly cover what Jeffrey Way (the editor of Nettuts+) discussed, HTML5 has certain tags like <header> that are not standard in HTML4. Certain browsers like Chrome or Firefox are up-to-date and will consider this a valid element. Thus, it will then accept CSS statements for the <header> tag.
IE will show text within <header> but will not reflect anything written in the CSS for <header>. This is because it does not consider <header> a valid element and, more or less, ignores it.
In this post I discuss how Way goes about solving this problem, and how it can be extended further.
-
Applying CSS to Any Custom HTML Tag
0 Comments Posted on January 21st, 2010Read More › -
Working with Elements in Deft
4 Comments Posted on November 29th, 2009 Updated on November 29th, 2009Read More ›Lately I've been working on a personal project, Deft, which is a JavaScript framework. Like everyone else I've been using existing frameworks to develop with. But over time I have gained a better understanding of the language and an idea of what methods a framework should offer. Deft is my effort to bring that idea to reality.
The following is an extremely quick glimpse of the functionality offered by Deft-0.5.js, an early build. In this post I will be focusing on working with elements. The framework is not complete so there will be more to come. But there is already a great deal of functionality.$('header')
.attr('style', {
'color': 'red',
'font-weight': 'bold'
})
.$('nav')
.attr('style', {
'opacity': 0.5
})
.back()
.addClass('ready');
In this example the element with an ID of 'header' is selected and its color and font-weight styles are set. An element within 'header' with an ID of 'nav' is then selected and a 50% opacity is applied. The chain then uses back() which returns to $('header') to which we end with adding a class of 'ready.' -
-
Good SEO Practices
1 Comment Posted on November 13th, 2009Read More ›Search Engine Optimization (SEO) is an interesting topic. There are a lot of ways people claim you can improve your search results. Some of them work. Some just don't. The problem is that there is one real search engine everyone always focuses on; Google. And Google is pretty secretive about how they rank websites.
At first their algorithms were pretty straight-forward. If you linked to a bunch of other sites and inject hordes of keywords in your <body> then you would likely move upward in ranking. But then black-hat search engine optimizers figured out that Google was doing this. These optimizers began to use it to their advantage. You may recall, years ago, coming across a page that seemed to have an obscene amount of 'dead space' at the bottom of the page. These optimizers would place large amounts of keywords usually using the same color as the background to hide them.
Long story short Google has continually caught on to optimizers taking advantage of their ranking algorithms and have tweaked them to avoid these types of situations, thus enforcing legitimate results. So, over time Google has become very cryptic as to how they rank sites. By leaving optimizers in the dark they are avoiding any misuse of their service. Yet, there are some well-known ways in which you can improve your pages to improve their ranking. This is what I will be covering for the remainder of this post. -
How to trim() in JavaScript
1 Comment Posted on November 10th, 2009 Updated on November 10th, 2009Read More ›String trimming has become a standard in APIs. In JavaScript there is no standard method to do this. So, most libraries like jQuery and MooTools add in their own trim functionality.
Adding a simple trim method is easy. All you need is the following code:String.prototype.trim = function() {
return this.replace(/^\s*|\s*$/g, '');
};
Now you can do the following:" asdf ".trim();
// "asdf"
"asdf".trim();
// "asdf"
This proves really useful. But it could be better. In PHP you can send an optional second parameter to their trim function that allows you to define characters to be trimmed. By default the function trims white space. -
Array Has Function in ASP
1 Comment Posted on October 19th, 2009Read More ›I'm often stuck working with ASP and wishing I were working with PHP. PHP has a great deal of methods available that make life a lot easier. And in ASP you find yourself writing custom functions to do something that would be trivial in a better language.
Checking to see if a value exists within an array is one example. ASP does not offer any quick or easy solution. In fact, ASP is pretty much a nightmare when it comes to working with arrays. It's usually easier to use scripting dictionaries.