Here is the html and css code to put colors, images, and moving things into your web pages. (I don't actually know how to make the movies and flash and animated gifs — that's a whole other line of work!)
See the web colors page for colors and codes.
| text effects: |
blink <blink>
sideways sliding <marquee> link rollover <marquee> |
| images: | image <img> |
| backgrounds: |
background image <style="background-image: url(IMAGE);">
background color <style="background-color: COLOR;"> |
| media: | show a movie, flash, or sound – <object> and <embed> |
| text effects |
top ↑ |
|---|---|
| blinking text | |
|
<blink> </blink>
|
example: Here is the code for blinking: <blink>
This is really annoying
</blink>
And here is how it looks: |
|
You can combine font colors, backgrounds ... any text formatting, with the blink tag. |
example: <blink style="color: #cc0000; background-color: #660000;">
<img src="images/new.gif" alt="new" />
Ouch! This is even more annoying!
</blink>
But you can't make an image blink with this tag. To do that, you need to make an animated gif in your image program (such as Photoshop, ImageReady, ... ) |
| marquee | |
|
A "marquee" in html is a way to make something that scrolls, or moves, across the web page. ("Marquee" is actually a french word, and it is prononced "mar-kay".) |
|
|
<marquee> </marquee>
|
example: Here is the code for a simple marquee: <marquee>
My Big Web Page
</marquee>
This will look (more or |
|
Again, you can combine font colors, backgrounds, anything. |
example: <marquee style="color: #006633; background-color: #ffcccc;">
<img src="new.gif" alt="new" />
Click <a href="./">here</a> — if you can!
<img src="new.gif" alt="new" />
</marquee>
|
|
attributes |
Look in any html reference for other things you can do with marquee: Make it go from left to right, change the speed, etc. |
| images |
top ↑ |
|---|---|
More about showing an image(For the basics of the <img> tag, see the graphics section of 2-html_tutorial-basics.html.) |
|
|
<img src="LOCATION" /> Attributes for the 'img' tag Here are attributes for the 'img' tag. You can use any of all of them, but of course you always have to use the 'src' attribute also – or you won't see any picture! width and height: Using the 'width', 'height' attributes will make the browser load the image faster.
width="NUMBER"
height="NUMBER"
The 'alt' attribute:
alt="TEXT"
So - always put something in the 'alt' attribute.
align="ALIGN"
|
example code: <p>
<img src="images/dalai_lama-sm.jpg"
align="right" />
Here is a picture of His Holiness ...
</p>
result in web page:
We are using this to demonstrate how we align a picture with some text. By using 'align=right', we tell the browser to put the picture on the right, and wrap the text to the left around the picture. Try using the same code, and change align="right" to align="left".
example code:
<p>
<img src="images/dalai_lama-sm.jpg"
width="199"
height="126"
align="right"
border="8"
alt="his holiness and the himalayas" />
Here is a picture of His Holiness ...
</p>
result in web page:
The border attribute makes a black border. We can use CSS language to change the border color, make background color, and many other interesting things. |
|
border="BORDER"
("BORDER" is in pixels)
|
no border on link — example code: <a href="somewhere/else/">
<img src="images/b_login.gif" /></a>
<a href="somewhere/else/">
<img src="images/b_login.gif"
border="0" /></a>
result in web page: |
| Backgrounds |
top ↑ |
|||||||
|---|---|---|---|---|---|---|---|---|
| background-color (see the CSS tutorial for how to use this code) | ||||||||
|
in your stylesheet, head style, or tag style div {
background-color: COLOR;
}
span {
background-color: COLOR;
}
See the web colors page for colors and codes. |
code example body {
background-color: #ffcccc;
color: #990000;
}
span {
background-color: #ffffff;
}
<p>
Here is some <span>text</span> with a <a href="./">link</a>.
</p>
result in web page:
|
|||||||
|
See the html reference and tutorial in this directory for more about the table tags. |
table with different background colors in cells and spans: The code for the this table is not really that complicated, but it takes up too much space for this little demo. So i didn't display the code here – i will let you 'view source' to see the code.
The background of the large right-hand cell is actually a small background image that repeats. The next section explains how to display background images. |
|||||||
| background images | ||||||||
|
in your stylesheet, head style, or tag style
background-image: url(PATH/FILENAME);
You can put background images in the page, as a style for the <body> tag, or in a table, a table cell, a div or p or span ... any block or inline tag! |
page with repeating background image: body {
background-image: url(images/grid.gif);
color: #336666;
}
|
|||||||
|
page with one background image: body {
background-image: src(images/dalai_lama.jpg);
background-repeat: no-repeat;
color: #000066;
}
a {
color: #ffffff;
}
|
||||||||
|
table with a background image: table {
background-image: src(images/kalm-valley.jpg);
}
Same as with a background image in a page – if the image is smaller than the table or the cell, it will repeat. In css language, you can make the image not to repeat, or to repeat only horizontally or only vertically. See the end of the background color section for an example of using a repeating image to make a pattern. |
||||||||
| putting it all together with style | ||||||||
|
Here's an example putting together the things we learned above. (Learn more about CSS in the CSS tutorial.) |
code example:
<div style="display: table;
padding: 0 12px;
background-image: url(images/grid.gif);">
<p>
<img src="images/dalai_lama.jpg"
width="200px"
style="padding: 8px;
margin: 0 12px;
background-color: #ffff99;
border: 5px double #cc0000;
float: right;"
alt="his holiness and the himalayas" />
Here is a picture of His Holiness ...
</p>
</div>
|
|||||||
| Media |
top ↑ |
|---|---|
|
Embedding media in your web page is a little tricky.
The code below works for Flash, Quicktime, RealPlayer, ShockWave, Java or Windows Media Player files. (But it is not recommended to use Windows Media Player files on a website, since they don't work everywhere.) |
|
|
<embed> - the embed tag. embeds a flash, movie, or sound on the web page.
The basic embed code is:
Remember that the movie or sound is still a separate file. It does not become part of your html file. It is recommended to always use the 'width' and 'height' attributes. These will make the browser load the video faster.
width="NUMBER"
height="NUMBER"
alt="TEXT"
Below are other attributes for the 'embed' and 'object' tags. You can use any of all of them, but of course you always have to use the 'src' attribute also – or you won't see any video/audio player! Sorry - coming soon ... Putting it all together with styleJust like with an image, put your media code inside of a div tag, and give it border, position, background-color, etc. |
code example: <object width="280" height="170">
<param name="movie"
value="Files4pages/tibetan_olympics.swf" />
<param name="allowFullScreen"
value="true" />
<param name="allowscriptaccess"
value="always" />
<embed src="Files4pages/tibetan_olympics.swf"
type="application/x-shockwave-flash"
allowfullscreen="true"
allowScriptAccess="always"
width="280"
height="170">
</embed>
</object>
result on web page: Learn more about media
More gory details
|
| Spoiling the Fun |
top ↑ |
|---|---|
|
Now i have to tell you something. These cool things are all fun, but — they can also be annoying, or even make it hard to use the website at all. When that happens, we have another name for them: "Stupid Web Tricks". It takes a real artist to use these Tricks in a way that adds to the site, rather than making it annoying. So go ahead and play with them all, and have fun! Then when you are making a real website, try to see the website as if you are the user of the site, who has never seen the site before. And then ask yourself, does this marquee, or bright color, or background image, help me use the site ... or does it get in the way? |
|
| copyright / license |
top ↑ |
|---|---|
|
Q: Can i copy this file? Can i give to other people? Answer: Sure, you can give it to anyone, according to the terms of the license below. It is copyright © 2004 James Walker. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included here. If not found, find it at www.fsf.org - the Free Software Foundation. |
|
| translation |
top ↑ |
|---|---|
|
It would be very useful to have translations of this document in any language. Most preferred would be Tibetan and Chinese. Please contact me if you can do a translation for us. |
|
| contact |
top ↑ |
|---|---|
|
Was this helpful? Is it clear, or confusing? I would be happy to hear anything about how to make this better. You can contact me at the email address i have given you, or at http://www.webwalker.to/contact.php |
|