Short Tag – Web Development Blog

Entries for the ‘HTML’ Category

Preload images with plain javascript

This is a continuation of my previous post, preloading images with jQuery.
More info about preloaders: here.
This articles is for those who wish to use preloaders but do not use jQuery.

function preload(images)
{
for (var i = 0; i < images.length; i++)
{
[...]

jQuery auto height/width

When changing the height of elements with jQuery you will probably have cases when you need to set the height to be on “auto”, so the browser will automatically calculate it’s height.
This is easy to do, see the example:

jQuery(".element").height("auto");

How does the height function work? If the parameter specified is a number the function will apply [...]

jQuery UI Datepicker – change z-index

There are cases when the Datepicker component will not show up, it will be hidden after another element in the page.
In this case you will probably want to change the z-index of the datepicker element. No need to change the source css/javascript code of the component.
This is how the Datepicker works: it takes the [...]

UL, LI – HTML and Css lists, horizontal positioning

The HTML lists (with CSS styling) are very handy for assembling HTML designs. They are very useful when creating menus, especially for horizontal menus. You could use tables to create a horizontal menu, but tables are overrated, they load harder than divs or lists and they are not good for SEO. You could use divs, [...]

Change the character set of your page with PHP and HTML

When using special characters you need to set the character set of your page, otherwise each browser uses the character set it pleases.
Let’s say my backend uses UTF-8 character set, then my frontend should use UTF-8 as well.
HTML code:
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
PHP code:
header(‘Content-type: text/html; charset=”utf-8″‘);
I use the both , but one should be [...]