230 likes | 251 Vues
HTML Basics. HTML = Hypertext Mark-up Language HTML is a plain-text file that can be created using a text editor like Notepad. When creating HTML files for the web, make sure you save them as .html – or they won’t work. Overview: Tags.
E N D
HTML Basics • HTML = Hypertext Mark-up Language • HTML is a plain-text file that can be created using a text editor like Notepad. • When creating HTML files for the web, make sure you save them as .html – or they won’t work.
Overview: Tags • As a text document, your HTML in Notepad will contain elements, such as headers, titles, paragraphs, etc. • These elements must be denoted in your script, which is done using tags • HTML tags consist of a left angle bracket (<), a name, and a right angle bracket (>) • For example: <title> • Tags must also close. To do so, you incorporate a slash (/). A starting and ending tag would be: <title> </title>
More Tags • Any HTML document should contain certain tags:-<html>-<title>-<body>-headings (such as <H1>)-<paragraph>
Adding Attributes to Tags • You can add attributes to tags to enhance your page. • Added attributes go inside the brackets of the opening tag (example: <p align=center> would center the paragraph) • A list of attributes can be found at http://archive.devx.com/projectcool/developer/reference/tag-table.html
Colors • Background and text colors are attributes of the “body” of the document. • text=“#xxxxxx” determines your text color • Bgcolor=“#xxxxxx” determines your background color • Colors and codes for HTML can be found at http://hotwired.lycos.com/webmonkey/reference/color_codes/
Lists • Lists are found inside the body, and are written as “<ul>” for an unordered list, or “<ol>” for an ordered (or numbered) list. • List items are denoted by “<li>” and do not require closing tags.
Links • The biggest thing that made HTML so popular was its ability to link to other documents or sections of documents. • A link is indicated by <a> (anchor). • The text that will become the link is identified with by <href> (hyperlink reference).
More Links • An example link would be: <a href=“document.html”>Link to document</a> • This would make the phrase “Link to document” a hyperlink to “document.html” assuming that it is in the same directory as your current file. • If the document is in a different directory, you need to include it in the path. For example: <a href=“extracrap/document.html”>
More Links • If you wish to make an external link, you have to write out the full URL. I recommend opening the page you want in a browser, then copying and pasting the URL. This prevents you from unnecessary typing or messing up. • For example: <a href=“http://www.theonion.com/onion3902/index.html”> • Just make sure that when you paste it in, you add the quotes (“”).
The href mailto: function • Another function of href can be to provide users with an opportunity to send you e-mail. • An example: <a href=“mailto:mpeters@ist.psu.edu”> • The full text, with something to link the function to would be: <a href=“mailto:mpeters@ist.psu.edu”>Send me an e-mail</a>
Adding Images • I suggest you make a folder for images in your directory – it will make it easier to refer to things. • The <image src=“??????”> tag will allow you to insert an image. ??????? Should be the path to the image file. • For example: <image src=“sample.jpeg> if the image named “sample” is in the same directory as your html file.
Images as Links • You can also href an image the same way you would with text, by including the <image src=“sample.jpeg> in place of the text between the href anchors. • For example: <a href=“www.catabus.com”><image src=“sample.jpeg></a> • Or, you could have “mailto:me@here.there” in place of the website.
Tables • Refer to table of table attributes
Frames • A Frame document is very much like a normal HTML document, but the “Body” container is replaced by the “Frameset” container. • Any tags that would normally be in the body cannot come before the Frameset tag, or it will be ignored.
Frame attributes • Rows:-Simple numbers mean pixel size-% means percentage value (ie: 33%) • Columns:-Function just like rows
Single Frames • <frame> defines a single frame in a frameset. • This tag has 6 possible attributes:-SRC-Name-Margin Width-Margin Height-Scrolling-No Resize
SRC • This attribute takes the URL of the site you want to display in the frame as its value. • A frame without an SRC value will be displayed as a blank space.
Name • This attribute lets you name your frame so that it can be targeted by links in other documents. • If you choose to name your frames, they must begin with letters or numbers, no symbols.
Marginwidth • This attribute gives you control of the width of your frames. • The value is in pixels, so <frame marginwidth=“170”> will be a frame 170 pixels wide. • Leaving out the marginwidth will allow the browser to determine the width of your frame.
Marginheight • Just like marginwidth, only vertically inclined.
Scrolling • This allows you to determine if there should be a scrollbar in your frame. • Scrolling has 3 values: “yes,” “no,” and “auto.”-Yes means there is always a bar, no means there is never one, and auto means it will be automatically determined. • You don’t have to include scrolling, the default is auto.
Noresize • This has no value (numerically, I mean) – it just indicates to the browser that the user has no control over the size of the frame. • This is also optional, and without it, the frame will be resizable.
A note on these attributes • These attributes are included in the <frame> and are separated by commas. • Example: <frame src=“http://statecollege.com/bartour/”, name=“College Life”, marginwidth=“170”, marginheight=“330”, scrolling=“auto”, noresize>