CodeinWP CodeinWP

A Consideration of Variable and Function Scope in JavaScript

A Consideration of JavaScript ScopeMany aspects of JavaScript code development are taken for granted, and scope is really no different. Of course, in many cases where minimal code is required, variable scope (or function scope) is a non-issue. But if you’re planning to get into larger application development with JavaScript, then you need to understand at least the basics on scope in JavaScript.

Using some simple code examples, I’m going to run through the basics of scope and try to give beginning to intermediate JavaScript developers a better grasp of this very important concept.

Read Article

10 JavaScript Quick Tips and Best Practices

JavaScript Quick Tips and Best PracticesRecently, a few blogs and tutorial sites have posted some really good articles on JavaScript tips and best practices, and I thought that was a good topic that could easily be expanded upon. So I put together a list of 10 fairly simple JavaScript tips and best practices of my own.

I tried to include stuff that was not mentioned in those other posts, but I’m sure there is a little bit of overlap. Keep in mind that these are brief tips and recommendations, so I don’t go into great detail about the reasons and such, but I may go into some of them in depth in future articles and tutorials.

In the meantime, please enjoy this list of tips, recommendations, and best practices for JavaScript coding.

Read Article

A Primer on the CSS Font Shorthand Property

CSS Font Shorthand PropertyIn recent years, as an off-shoot of the “web 2.0” movement, typography has really taken off and now plays a major role in web design. And font usage is also quite an important factor in CSS development — despite that it has not gotten to the point where any font can be used freely without some tricky, sometimes complex workarounds.

Font declarations and related properties in CSS are fairly straightforward to write in longhand. But there is a shorthand CSS property for declaring certain typographical properties that is well-supported across all common browsers, but a little quirky to work with. In this article I’ll describe how the css font shorthand property is used, how it can be misused, and what potential drawbacks there might be to including it in your CSS code.

Read Article

A Detailed Look at the z-index CSS Property

Z-Index PropertyMost CSS properties that a web developer deals with regularly are instantaneous in their application to elements on the page. For example, when you add the background-color or font-size property to an element on your page, in most cases you will see the results immediately upon page refresh. But other CSS properties are not quite as “plug and play” as we would like.

The z-index property is one example of the latter. I would venture to guess that z-index is probably the CSS property that is more speedily abandoned than any other. Very often — when I previously didn’t understand z-index — I would try to apply it to an element, hoping that the element would automatically “jump” to the top in the page’s stacking order. But that didn’t happen, so I would abandon that method and try some other way to solve the problem. Maybe you’ve had the same experience. Hopefully this article will clear up some misunderstandings regarding z-index.

Read Article

Ajax From the Ground Up: Part 2 – Sending Data to the Server

Ajax From the Ground Up - Part 2This is the second tutorial in a series explaining how to implement Ajax “from the ground up”, so if you haven’t yet checked out the first tutorial, then please do so now, as this one will be building on code from part one.

In the first part, we learned how to create an instance of the XMLHttpRequest object in a cross-browser fashion. In part 2, we’ll discuss the code needed to start communicating with the server. The result of this tutorial will help us send data to the server.

Read Article

Ajax From the Ground Up: Part 1 – XMLHttpRequest

Ajax From the Ground Up - Part 1It started out as an industry “buzzword” and has slowly progressed into one of the most important web technologies in use today. It is easily implemented using your favourite JavaScript framework. It can provide a beautiful layer of enhancement to many web applications, helping to improve page-load times and greatly improve the user experience. It can also degrade the user experience and cause a web application to fail if a particular client-side technology is unavailable.

Yes, I’m talking about the web methodology immortalized by Jesse James Garrett called Ajax. (As Garrett points out, Ajax is not a technology, but several technologies.) This article will begin a multi-part tutorial series in which I will explain how to implement Ajax “from the ground up”. This series will be geared towards web developers who would like to better understand Ajax in its raw format, using pure JavaScript.

Read Article

Everything You Need to Know About !important CSS Declarations

The !important CSS DeclarationRecently I came across a few articles that mentioned CSS !important declarations, and there was a little bit of confusion over what they actually did, and how they could be used, as expressed in the user comments on those articles.

So I thought I would research this unique CSS property/value appendage and do a comprehensive write-up on it that would go through essentially all the information developers should have before considering its use in their style sheets.

This article will discuss what !important is, how it’s used, some practical uses for it, and drawbacks that need to be considered before implementing it.

Read Article

How To Put a Multi-Line Indent on a Styled Blockquote

Multi-Line Blockquote IndentThis brief and easy tutorial provides a method to indent multiple lines of text around a background image on a styled <blockquote> element.

When I wrote the previous post, listing 25 Classic web design articles, I included a styled <blockquote> for each of the listed articles. This is obviously nothing new; virtually all design blogs have a fancy blockquote styled with a double quotation mark in the background or something similar.

But when I was laying out the blockquote in Photoshop, I didn’t like the way it looked with the entire left side indented. Here is how I originally intended it to be:

Read Article

25 Classic Web Design Articles That Significantly Impacted the Way We Code

25 Classic Web Design ArticlesOver the years there have been hundreds, if not thousands of articles published online that have each had a tremendous impact on the world of web development and design. Some have been truly memorable, and have remained quite relevant for years, and remain so today. Others have outlived their usefulness, but we remember them because of the impact they had on our code and on the way we think about web design.

Occassionally, while reading or doing research, I still stumble upon “classic” web design articles. So I thought it would be a great idea to list what I feel are some of the most important articles that have been published in the relatively short history of the web development industry.

Originally, I had started with the idea of listing 10 articles — but when I began the research, I slowly started to realize that was not going to do justice to this list. So I settled on 25. I think this is a good collection of some of the more significant articles that have been produced over the past 13 years or so.

Read Article

10 WordPress Tips to Make Your Blog Look Like a Website (for Beginners)

WordPress Tips - Make Your Blog Look Like a WebsiteWhatever industry you happen to be in, you want to stand out from the crowd and be unique, and not give the impression that your online presence is just a slightly modified cut and paste job. Of course, if you’re depending on a pre-built content management framework like WordPress for the core of your blog or website, then that could prevent your online presence from truly standing out.

So, in this article I’ll run through 10 fairly straightforward ways that a beginning developer or blogger can customize their WordPress theme to ensure it doesn’t “look like a blog” — at least to a certain degree. Keep in mind that the goal here is not to hide the fact that a website is using WordPress — that’s quite difficult, if not impossible. The ultimate goal here is to help your website have a seamless, consistent, look and feel that does not necessarily scream “WordPress-driven” from the instant the home page loads up.

Read Article