CSS Specificity is the weight (and value) a web browser gives to a particular CSS rule. Browsers give preference to rules which have a higher weight (the fatter the better!). Rules that have a higher weight will overwrite rules that have a lower weight. Let's take a look at a simple example below.
A Simple Example of CSS Specificity
background: #0000FF; /** blue */
background: #FF0000; /** red */
In t... Read more.
Have you ever wanted to know how many lines of code your web application consists of? I have. To find out, I created a recursive function in PHP to count the number of lines in files relating to my web application. Since your entire web application is likely to reside under one directory (that's the assumption I use in this article), we can count the number of lines in each file, and disinclude any files that don't have the file extensions we're looking for. For example, the sy... Read more.
Cross-Site Scripting (XSS) is a type of attack where a hacker attempts to inject client-side scripting into a webpage that others are able to view. The attack could be as simple as an annoying alert window or as sophisticated as stealing a logged in user's credentials (commonly saved in browser cookies). With a user's credentials, a hacker could gain access to sensitive parts of your website or web application. In this simple guide, I'll show you a few ways to protect your webs... Read more.
HTML forms make up a large part of the web. They are the primary method for retrieving input from users. Typically, you fill out the form, click the submit button, and be redirected to a thank you page. For web applications, this may not be ideal - you may not want the user to leave the page. In this article, I'll show you how to use jQuery's AJAX function to submit a form asynchronously to the server and avoid a redirect.
A Simple Contact Form
Here's an example of a simple contact... Read more.
This is the last part of a three part series on how to implement keyboard shortcuts in a web application. In this part, we'll update our keyman object and prevent any keyboard shortcuts from activating if a user is typing into a textfield on a form. We'll also go over a couple problems you might run into when using keyboard shortcuts. If you missed the first or second part of this series, you can click either of the below links to get to them and get caught up!
How to Capture Keyboard Shortcu... Read more.