Web design blog

Latest Posts

  1. Get the date with PHP

    %postname%

    Get the date using PHP. This date will match your server configuration. Note the case and the spaces for formatting. See the PHP Date documentation for full details.

  2. Add class with jQuery

    %postname%

    This snippet shows an extremely simple way of adding a class to any element, ID or class using the jQuery selector. Here are several examples: Add ‘open’ class to all/any div elements. Add ‘open’ class to all/any elements with the ID ‘content’. Add ‘open’ class to the first li. For this to work you need […]

  3. CSS clear floats

    %postname%

    When floating HTML elements using CSS, you probably would have seen that parent elements behave strangely, not positioned correctly and sometimes collapsing entirely. “Clearing” the floating elements needs to be dealt with to avoid serious layout issues. For more information see this amazing article by Chris Coyier explaining much more about floats and the clearing […]

  4. Disable form autocomplete

    %postname%

    This snippet shows how to disable the browser’s “autocomplete” feature (if available). For mobile situations you can also disable autocorrect and autocapitalize: EDIT: If the HTML above doesn’t work or you’re not happy with it you can always try using this JS

  5. If HTTP or HTTPS connection with PHP

    %postname%

    This simple snippet looks for whether the connection to the web server is secure of insecure. This can be useful for various reasons like displaying internal pages to logged-in users, display payment pages, etc.

  6. HTML page redirect

    %postname%

    This snippet is a very simple and effective way of redirecting a page to a specified URL, using a simple HTML Meta element. Add this code between and . The snippet below will redirect after 0 seconds. The snippet below will redirect after 5 seconds. Note: There are other, more efficient ways of doing this […]