Archived copy for reference only
 

 

Graphic Design / Interactive Design / Fine & Applied Arts / Parkland College

Interactive Design Student Handouts:
Code Snippets

(Archived from 2019)

Dreamweaver writes wonderful code for you, but it can't do everything. Sometimes, the only way to achieve a specific effect is write custom code or to copy and paste the code into Dreamweaver manually. The following snippets might come in useful.

CSS Reset

Because of browser incompatibilities, web designers like to start with a "blank slate" before writing any CSS code. There are many flavors of "reset styles" that wipe out these incompatibilities available, but Eric Meyer's version is very popular. This is a slightly modified version of his code:

Phantom Scroll Bar Fix

You may have noticed that when clicking from a long web page (with a scroll bar) to a short web page (without a scollbar) will cause page elements to "shift." One solution is to add a "phantom" scroll bar on the right regardless of whether there is enough content to warrant it. The following CSS will accomplish this:

html {overflow-y:scroll;}

Close Window

This Javascript code can be added to a link which will close the current window when clicked. This is especially useful when creating pop-up windows.

Open links in new window/tab

Adding target="_blank" to links may not be supported in future releases of HTML. If you still want a link to open up in a new window/tab, here is a Javascript alternative.

Pop up Windows

Dreamweaver has a built-in behavior to open browser windows at a specific size. Unfortunately, it requires that you use "#" as the link, which will scroll your main page back to the top (unless you start adding named anchors). An alternative is to use the following code instead (which also happens to be accessibility friendly).

Open Page in Frameset

If a page is intended to be opened only within a frameset, this script refers the browser immediately to the frameset page.

BACK TO TOP
Last updated: 5/7/21 • Webmaster: Paul Young <pyoung.parkland@gmail.com>