html

Redirect webpages with HTML, PHP, .htaccess, Java+Script, CGI-Perl, ASP.NET and ColdFusion

Here are examples of code how to redirect an old page/url/domain to a new one with most popular client+server side programming/scripting languages. We use 301 http status code (permanent redirect). If you need temporary redirection use 302 status code instead of 301. It is better to prefer server-side redirection, because some clients are surfing with javascript and http-refresh disabled browsers. Do not forget to test your code first!

.htacces and Mod_Rewrite (Apache Webserver)

Why tableless design, DIV vs. TABLE

Everybody says avoid tables when you are creating design elements like layouts, themes, pages... Why?

Because:

  • Main
    (X)HTML says; tables are for tabular data not for website-layout
  • Speed
    Tables have much design code than content, divs are faster for download. Save bandwidth!
  • Usability
    Tables let confusing while creating layout(You have to remember which TR or TD ends in which template file)
  • Debug

DropDown / Rollover Menu with pure CSS / HTML

CSS Menu without JavaScript, Pure-CSS, Hidden, Mouseover-EffectThis is another CSS Menu with changed direction. Many website visitors are online with javascript-disabled clients(because of filters, access rules etc). And you want use a nice rollover multi-level menu on your homepage. CSS ist the perfect solution for this. All modern browsers like Mozilla Firefox, Microsoft Internet Explorer, Opera, Google Chrome, Apple Safari support css.

CSS hierarchy and inline style sheets

I have a problem with inline stylesheets. I like to use inline style sheets instead of using css code in head section of an html page or an external .css file.

Example:


But I have a problem when I want it to ffect just a part of subelement and not other paralell elements. Example 2:

    • ...

I want to my third-level "ul" have border but second-level not. I can do it with css code like this:

div ul { border: none; }
div ul li ul { border: 1px solid red; }

Table colspan rowspan with DIVs

I want to use DIVs and CSS for my layouts etc. I need some table like areas sometimes. I know that I can create a grid table like element with "display: table", than "display: table-row", than "display: table-cell".

But how can I create a table with colspan and rowspan with CSS and DIVs? Without DIV floating and fixed with / height...

Preload images with JavaScript or CSS

I have a small website with two background images for top menu. When I bring mouse first time over a menu element it takes 2-3 seconds that second background image loaded (style link:hover background: url(secondimg.png)). For this short time user see nothing, of course it is annoying. To escape this situation I want to preload all images inklusive background images for menu elements, links, divs etc. Is there a very easy and short javascript or css trick? Thanks for any help!

Unpublished
n/a

Common HTML / Web colors

This is the list of webcolors also knows as web safe colours. Click on colors to see in action as container-background.
000000 000033 000066 000099 0000cc 0000ff 003300 003333 003366 003399 0033cc 0033ff 006600 006633 006666 006699 0066cc 0066ff 009900 009933 009966 009999 0099cc 0099ff 00cc00 00cc33 00cc66 00cc99 00cccc 00ccff 00ff00 00ff33 00ff66 00ff99 00ffcc 00ffff 330000 330033 330066 330099 3300cc 3300ff 333300 333333 333366 333399 3333cc 3333ff 336600 336633 336666 336699 3366cc 3366ff 339900 339933 339966 339999 3399cc 3399ff 33cc00 33cc33 33cc66 33cc99 33cccc 33ccff 33ff00 33ff33 33ff66 33ff99 33ffcc 33ffff 660000 660033 660066 660099 6600cc 6600ff 663300 663333 663366 663399 6633cc 6633ff 666600 666633 666666 666699 6666cc 6666ff 669900 669933 669966 669999 6699cc 6699ff 66cc00 66cc33 66cc66 66cc99 66cccc 66ccff 66ff00 66ff33 66ff66 66ff99 66ffcc 66ffff 990000 990033 990066 990099 9900cc 9900ff 993300 993333 993366 993399 9933cc 9933ff 996600 996633 996666 996699 9966cc 9966ff 999900 999933 999966 999999 9999cc 9999ff 99cc00 99cc33 99cc66 99cc99 99cccc 99ccff 99ff00 99ff33 99ff66 99ff99 99ffcc 99ffff cc0000 cc0033 cc0066 cc0099 cc00cc cc00ff cc3300 cc3333 cc3366 cc3399 cc33cc cc33ff cc6600 cc6633 cc6666 cc6699 cc66cc cc66ff cc9900 cc9933 cc9966 cc9999 cc99cc cc99ff cccc00 cccc33 cccc66 cccc99 cccccc ccccff ccff00 ccff33 ccff66 ccff99 ccffcc ccffff ff0000 ff0033 ff0066 ff0099 ff00cc ff00ff ff3300 ff3333 ff3366 ff3399 ff33cc ff33ff ff6600 ff6633 ff6666 ff6699 ff66cc ff66ff ff9900 ff9933 ff9966 ff9999 ff99cc ff99ff ffcc00 ffcc33 ffcc66 ffcc99 ffcccc ffccff ffff00 ffff33 ffff66 ffff99 ffffcc ffffff

Common HTML tags for fast copy-paste

Every webmaster needs some common html tags like a,table,img,div,headings or embed code for windows media player or adobe(formerly macromedia) flash very often. Mostly it is possible to save much time to just easily copy-paste empty tags instead of write them. Therefore I am trying to create a useful list with possible examples. Feel free to add suggestions with examples.

Horizontal list from ol / ul li

how can I create a horizontal list from list elements like ul li or ol li ? all must be placed on the top of page in one line also no newline or br etc. i tried with dreamveaer but did not work, please help!

Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.