Free webspace Room

Click to return to Archives


Code Snippets and Tips from CPS.


This page will contain useful Code and Tips that may be of use to you.
If you have any yourself please post them in the main room.
They will be checked out and if they comply, moved here.
It is hoped to compile a data base to help us build websites.
They must be short and functional for long term use.

Index
General Tips.
Saving text/code pages.
CSS Tips
HTML Tips



General Tips
Write all your "html code in lower case", leave capitals to profesionals.
Useing lowercase removes a major sorce of errors in code work.
Saving text/code pages
This looks long winded but its not, its the explanation thats long.

Point one.
To use these tutorials you will need "windows notepad", you will find it by clicking "start,
programs, accessories" and you will see "notepad" in the list.

Tip No:1.
Make Notepad available. R/Click on notepad, in the dropdown list rest your arrow on "send to" in the next dropdown list find "desktop (create shortcut)" L/click on it.
This will place an icon on desktop and give you easy access to "notepad".
You can also press and hold Left mouse button and drag the icon onto your quick launch bar (bottom left of screen), for instant use.

Point two.
Saving your pages see below.
Find the text/code you want, place pointer at start of text/code, press and hold L/mouse button ,
drag to end of text/code and release button, the selected text/code will be highlighted.
R/click on it, select copy, open notepad, in notepad window R/click and select paste and your text/code will appear.
Now select File in notepad tool bar and click save, in the popup save window type the file name add the extension ".txt"/".htm" note the dot, so you will have "page/name.txt"
If its a code file thats to be saved use the extension ".htm" (leave no spaces) it should be stated if its text or code,
if not look for .txt or .htm.
Navigate in the save window to your file/folder open it by clicking on it, and select save and your file will appear in your file/folder.
Remember always save a code page and title as shown and stated by the auther.
Repeat the the above for all text/code pages.
Any problems please ask in a post or PM



CSS Tips
Short for cascading style sheets and placed between the "Head Tags".
Known as embedded style sheets and controls the page its placed in.
Another form is a remote style sheet, were the code is placed in it own page and linked to a website,
mainly used on large sites.
Any changes made to the remote page effect the entire site.
Embedded style placed between HEAD TAGS

Tip 1
This one contols all your link colors on the page change colors to contrast with your page color.
Standard link color is BLUE
.
NAME----------DESCRIPTION
:link-----------The default state of an un-visited hyperlink.
:hover---------A hyperlink that has the curser over it.
:active---------A hyperlink that is being clicked by user.
:visited--------The default state of a visited link.


Code:
Simple version

<style type="text/css">



Code: Complex version
<style type="text/css">>



Tip 2
This one places a border around your page.
Change color to suite.
Code:
<style> body{border: double thick white} <style>


Tip 3
This one holds a back ground image stationary, only the text will scroll.

Code:
<style>
<!-- body {background-attachment: fixed;} //-->

The above are placed between the head tags of a page.





HTML Tips
Tip 1
This one holds a back ground image stationary, only the text will scroll.
Useing HTML this time, place just below start of body tag.

Code:
<body background="backdrop.jpg" bgproperties="fixed">


Click to return to Archives