Docsity

HTML Cheat Sheet: Understanding Tags, Attributes, and Headings, Lecture notes of Web Programming and Technologies

Toggle sidebar
bg1
BasicHTMLCheatSheet1
HTMLTags
HTMLworksinaverysimple,verylogical,format.Itreadslikeyoudo,toptobottom,lefttoright.That's
importanttoremember.HTMLiswrittenwithTEXT.Whatyouusetosetcertainsectionsapartas
headings,subtitles,boldtext,underlinedtext,etcisaseriesoftags.
TagFormat
• HTMLtagsareusedtomark‐upHTMLelements
• HTMLtagsaresurroundedbythetwocharacters<and>
• Thesurroundingcharactersarecalledanglebrackets
• HTMLtagsnormallycomeinpairslike<b>and</b>
• Thefirsttaginapairisthestarttag,thesecondtagistheendtag
• Thetextbetweenthestartandendtagsistheelementcontent
• HTMLtagsarenotcasesensitive,<b>meansthesameas<B>
Alltagformatsarethesame.Theybeginwithaless‐thansign:<andendwithagreater‐thansign:>.
Always.Noexceptions.Whatgoesinsidethe<and>isthetag.LearningHTMLislearningthetagto
performwhatevercommandyouwanttodo.Here'sanexample:
Thetagforaparagraphis"p".Thatmakessense.
Forexample:
<p>Thisisaparagraph.</p>
ThemajorityofHTMLtagsdorequirebothanopenandaclosetag(abeginandendtag).Mostarevery
easytounderstandbecausethetagisobvious.Hereareafewandwhattheydototext:
<strong>Thistextwillappearbold</strong>
<em>Thistextwillappearinitalics</em>
<u>Thistextwillappearunderlined<u>
Followthisrule:
Alwayssetthebeginningandendtagsatthesametime,alwaysplacingthemonthefarthestendofthe
itembeingaffected.Inotherwords,thefirsttaginisthelasttagout.Forexample:
<strong><em>Strongandemphasis</em></strong>
The<strong>tagisthefirstonein,and</strong>isthelasttagout.
pf3
pf4
pf5

Partial preview of the text

Download HTML Cheat Sheet: Understanding Tags, Attributes, and Headings and more Lecture notes Web Programming and Technologies in PDF only on Docsity!

HTML Tags HTML works in a very simple, very logical, format. It reads like you do, top to bottom, left to right. That's important to remember. HTML is written with TEXT. What you use to set certain sections apart as headings, subtitles, bold text, underlined text, etc is a series of tags. Tag Format

  • HTML tags are used to mark‐up HTML elements
  • HTML tags are surrounded by the two characters < and >
  • The surrounding characters are called angle brackets
  • HTML tags normally come in pairs like and
  • The first tag in a pair is the start tag, the second tag is the end tag
  • The text between the start and end tags is the element content
  • HTML tags are not case sensitive, means the same as All tag formats are the same. They begin with a less‐than sign: < and end with a greater‐than sign: >. Always. No exceptions. What goes inside the < and > is the tag. Learning HTML is learning the tag to perform whatever command you want to do. Here's an example: The tag for a paragraph is "p". That makes sense. For example:

This is a paragraph.

The majority of HTML tags do require both an open and a close tag (a begin and end tag). Most are very easy to understand because the tag is obvious. Here are a few and what they do to text: **This text will appear bold** _This text will appear in italics_ This text will appear underlined Follow this rule: Always set the beginning and end tags at the same time, always placing them on the farthest end of the item being affected. In other words, the first tag in is the last tag out. For example: **_Strong and emphasis_** The tag is the first one in, and is the last tag out.

Single Tags The open and close tag format dominates the majority of the available HTML tags, but there are tags that stand alone. Here are two useful ones: **** This command gives you a line across the page. (HR stands for Horizontal Reference.) The tag can also be modified using the following as a guide: Which will give the following results:
This Breaks the text and starts it again on the next line. Remember you saved your document as TEXT so where you hit ENTER to jump to the next line was not saved. In an HTML document, you need to denote where you want every Carriage return with a
. You can write your HTML by hand with almost any available text editor, including notepad that comes as a standard program with Windows. All you need to do is type in the code, then save the document, making sure to put an .html extension or an .htm extension to the file (for instance "mypage.html"). Open Notepad and type in the following: **

** Title of page **

** This line is a header **

** this line is a paragraph of text. **

** This text is bold **

** Save the file as "mypage.htm". Start your Internet browser. Select "File>Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created ‐

Headings Headings are defined with the to tags. defines the largest heading. defines the smallest heading. This is a heading This is a heading This is a heading This is a heading This is a heading This is a heading Comments in HTML The comment tag is used to insert a comment in the HTML source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later date.

Note that you need an exclamation point after the opening bracket, but not before the closing bracket. The following example shows the use of a comment tag. **

** Title of page **

**

**** This line is a header **

** this line is a paragraph of text. **

** This text is bold **

** The above code will look like this:

This line is a header This line is a paragraph of text. This text is bold What is a Hypertext link? A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link's destination. There are two parts to a link:

  • One part tells the human what to do.
  • The other part tells the browser what to do.
  • Here is an example: Click here to go to our Home Page will produce a link that looks like this: Click here to go to our Home Page