![]() |
|
| You are here: Home > Educators > Business Studies > Marketing > Simple Business Web site: How to Create Web Pages | |
|
|
Simple Business Web site: How to Create Web PagesThis resource is designed specifically for Unit 6 of the Edexcel BTEC qualification, 'Business Online'. AimIn this section we examine how Web pages are produced using HyperText Markup Language (HTML). The structure of HTML will be explored and code examples provided. There is also a discussion of authoring tools and an introduction to basic formatting with in Web pages using Cascading Style Sheets. Writing Web pagesWe have divided this section into the following sub-sections:
An introduction to HTMLWeb pages are written in a language called HTML or HyperText Mark-up Language. As its name suggests, HTML is a mark-up language meaning that sections of text are marked up with special tags that indicate what the text is. For example, there are special tags (also called elements) to indicate that a particular piece of text is a paragraph, a heading, a quote or an address. These tags act as instructions to the Web browser and 'tell' the browser what to do with that bit of text. For example, a heading tag tells the browser to display that piece of text larger than the rest of the text in the page. An example tag:
You can have uppercase or lowercase tags. However for the purposes of compatibility with the latest version of HTML we strongly recommend you use lowercase tags and always make sure your attribute (for example: <p align="center">) appears within quotes ("). Basic Web page structureHTML has a strictly defined structure, you cannot just put the tags wherever you want. One of the most common mistakes made by people new to writing Web pages (and even some 'professional' Web developers) is that they do not understand how tags can be nested and the correct structure of an HTML document (or Web page). The correct structure for an HTML page is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Now let us examine each line in turn: Task 1IMPORTANT - Downloading an HTML template for use in later tasksThe best way to learn HTML is to try it out. To do this all you need is a text editor. For example: Notepad on a Windows PC (not WordPad), SimpleText for Mac and Emacs, Nano or Vi for Linux. You will also need to have a Web browser installed on your computer so you can view your HTML page. One of the most common Web browsers is Microsoft Internet Explorer(http://www.microsoft.com/windows/ie/default.mspx), however, there are a wide range of Web browsers and it is a good idea to try out your pages in a variety of browsers. Excellent alternatives to Internet Explorer (particularly if you do not use Windows) are:
Having made sure you have access to a text editor and a Web browser you can now download an example HTML template for use in later tasks. Follow the below instructions carefully:
Irrespective of the text editor you are using the process by which you edit and view your changes to the HTML document you downloaded above is as follows. These instructions do assume you have some familiarity with a text editor, if this is not the case you should refer to the manual or help pages within the text editor before continuing:
Having edited and saved the HTML file you now need to view your changes in a Web browser.
Basic HTML tagsHTML tags are usually English words or abbreviations.
<p>This is the first sentence in a paragraph. This is the second.</p> - a paragraph It is important to note that there are only six heading sizes, there is no <h0> or <h7> etc. In order to control the size of these six headings Web developers use a technology called Cascading Style Sheets. Other tags affecting the appearance of text include: Physical styles:
Logical styles:
In practice you should use logical styles in preference to physical styles. This is because not all Web enabled devices (particularly some mobile phones) are able to display bold or italic text. By using the logical styles you instruct the Web device that you want this piece of text emphasised or given strong emphasis and, depending on the capabilities of the device, it will display the text appropriately. Exceptions to this rule are, for example, scientific names for species which (by convention) are always italicised, e.g. Bufo bufo - the common toad. Task 2Using the HTML tags discussed in the section above add some headings and paragraphs to the HTML document you downloaded and began editing in Task 1. Now try giving some of the text emphasis and strong emphasis using the logical styles above. Adding lists There are two types of list: Unordered list
<ul> The above produces:
Ordered list
<ol> The above produces:
Lists can also be nested:
<ol> The above produces:
Other tags include:
<sub> - subscript, e.g. H20 Task 3Using the basic structure of an HTML page (downloaded in Task 1) produce a Web page for a fictitious company. Assume the company sells sporting goods to individuals and direct to other businesses. Start the page with a heading (the company name) and provide a paragraph about the business. Then produce a bulleted list of your business activities: Sales to individuals; Sales to trade (including gyms and sports centres); Product support/aftersales care; Training advice. Now view your page in a Web browser. HTML entities You may be wondering how a Web browser can display <, > and " if they all appear in HTML tags?
As a result we also need an entity for &, for this we use & Other characters require the use of an entity rather than typing the character directly into a page. Some other common entities include:
There are online lookup tables for characters and their equivalent entities. (http://www.htmlhelp.com/reference/html40/entities/latin1.html) Adding images: Images are added to Web pages using the <img> tag, for example, <img src="/images/homepage/brown.jpg" alt="The Chancellor of the Exchequer, Gordon Brown. Copyright: World Bank and International Monetary Fund Spring Meetings Begin, Getty Images available from Education Image Gallery." height="67" width="67" border="1"> inserts the following picture:
The attributes used in the above HTML code are:
Task 4Save the image below to your computer by right-clicking on the image below and selecting 'Save Image As' (or 'Save picture as'). When prompted select an appropriate filename and save the image in the same directory/folder as the HTML file you produced in the tasks above.
Now add the image to one of your HTML pages using the code above. Remember to change the values of src, alt, width and height for the image being used. Linking to other pages Linking to other pages is what makes the Web a web. To create a link you must use the <a> tag: <a href="online1.htm">Principles of Online Presence</a> The above code produces the following link: Task 5Using the basic structure of an HTML page, create a second Web page for your business Web site. On this second page list the categories of sporting goods you sell to individuals. Now save this page in the same directory/folder as the first page and create links between them (from the 'Sales to individuals' item in the bulleted list). You should also create a link from the second page you created back to the first. Now view your page in a Web browser and test the links. Creating tables Tables are used to present tabular data.
Tables usually contain four different tags:
Refering back to the table above and the explanation of the tags look at the following code for the same table:
<table border="1" cellspacing="0" cellpadding="4" summary="UK GDP data for the four yearly quarters in 1994"> You will notice that the <table> tag contains a number of attributes, these are:
Tables with hidden borders are often used to provide the structure of a Web page and position graphics and text. However, this practice has now been superseded by the use of Cascading Style Sheets. Task 6Returning to the first Web page you created earlier, add a table listing your 'top-selling' products and their cost. Also add links to external Web pages on activities relating to your 'top-selling' products. For example, with 'footballs' you could add a link to BBC Sport's Football pages (http://news.bbc.co.uk/sport1/hi/football/default.stm). Now view your page in a Web browser. In this section we covered the basic structure of an HTML page and a few of the most common tags. You are strongly recommended to read some of the resources listed in the next steps section. Authoring Web pagesWeb pages can be written in nothing more complicated than a basic text editor. Many Web developers learn their trade by hand-coding pages. In fact, you can almost always spot someone who learned to write Web pages by hand-coding from someone who has always used an HTML editing tool. The code of the former is often more efficient and if any problems occur they know exactly where to look. Having learned how to produce Web pages it is often desirable to use an authoring tool to help you. These tools reduce the time it takes to produce Web pages and the potential for you to introduce errors into your HTML. Excluding text editors which we have already met, there are two other types of tools that can be used to produce Web pages:
The type of editor you use is often down to a matter of personal taste (and cost). However, text and code editors have an inherent flexibility that isn't present in many WYSIWYG editors. The HTML language is still developing and has been improved and added to over the years. Text and code editors are not tied in to producing a particular version of HTML so with relatively little effort these tools can be used to produce pages adhering to the current HTML standards. In contrast, WYSIWYG editors produce the code for you and consequently the programs must be updated in order to produce HTML adhering to current standards. These updates must be performed by the software publishers and often constitute a new version of the software and an associated cost implication. In addition, there is also a delay between the release of a new HTML version and the update to the WYSIWYG software. The above is also true for Cascading Style Sheets (the technology used to control formatting and presentation within Web pages) since, by their nature, WYSIWYG editors must also write this code for you too. Task 7Consider the reasons why a business may choose to buy WYSIWYG software to enable staff to maintain the company's Web site. How might the size of the business affect this decision? Basic formatting with CSSHTML is used to control the structure of a Web page. As we have discovered, there are tags defining text forming paragraphs, headings, lists, etc. During the mid-90's Netscape introduced the <font> tag (Microsoft extended it with additional attributes), this tag was adopted as a way of changing the font face, size colour, etc. Unfortunately, the addition of the <font> tag meant that the HTML was no longer just defining the content/structure of the page but also the presentation. Failing to separate content from presentation results in overly-complex pages and considerably reduces interoperability (the display of Web pages in a wide variety of Web enabled devices) - for example, a Web browser on a mobile phone also needs to understand the additional tags controlling presentation even though it may not be able to display the font face specified, etc. As a result the <font> tag (and other similar presentational tags and attributes) have been deprecated and should not appear in Web pages. Instead a technology called Cascading Style Sheets (CSS) should be used. CSS can control the look and feel (size, font face, colour, spacing, etc.) of text in addition to being used to position the different parts of a Web page. CSS can be utilised in three ways:
Inline CSS Inline CSS takes the form of an attribute within the particular tag that you want the style applied to. For example: <p style="font-size : 110%; color : #111199; background-color: #cccccc;">Example paragraph with presentation controlled by CSS.</p> produces... Example paragraph with presentation controlled by CSS. You will notice that the value for the style attribute contains a number of properties and values:
Another common use of CSS is to change the font face... <p style="font-family: Times, serif">Example paragraph in Times font.</p> produces... Example paragraph in Times or serif font. When defining a font family to be used it is usual to provide a series of font names and end with a generic font family (sans-serif or serif). If the main font is not present on the user's machine the Web browser will look for the next font in the list and so on until a font is present or the generic family is used. Internal CSS 'Inline CSS' is applied directly through the use of a style attribute within the HTML tag. The style only applies to that particular tag, however, it is possible to use 'internal CSS' to apply styles throughout an HTML page. The styles must go in the <head> part of the HTML page, for example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> The styles are contained within the <head> section of the document. The comment tags (<!-- and -->) must be included to hide the styles from older browsers that do not support CSS. The properties and values of the styles are also enclosed between curly brackets { and }. Note how the two styles are defined, the first refers solely to p tags and, as such, will be applied to all paragraphs. The second style starts with a . and then a name (.anotherexample). This allows the latter style to be applied to other tags using the class attribute, as illustrated. You may be forgiven for thinking that the above example might produce a page looking like: Example paragraph with presentation controlled by CSS. Example paragraph in Times font. However, the actual result would look like: Example paragraph with presentation controlled by CSS. Example paragraph in Times font. You will remember that CSS stands for Cascading StyleSheet and the above demonstrates 'cascading' in action. If you look at the example code we have applied a font-size, color and background-color to all paragraph tags. The second paragraph has a style (called anotherexample) appled to it using a class attribute - this second style changes the font-family of the paragraph. However, since this is also a paragraph it adopts the styles defined for all paragraphs and hence has a grey background, blue text and increased font size as well. Task 8Add an internal stylesheet to your pages and use it to add a bit of colour to the text within your Web page. Now view your page in a Web browser. External CSS In the above section we looked at 'internal CSS'. The stylesheet is just a collection of styles within the <head> section of the document. However, it is possible to take these styles and store them in a separate document called an external stylesheet or external CSS. This document contains only the styles, for example:
p {font-size : 110%; color : #111199; background-color: #cccccc;} External CSS documents are often given a .css file extension. The advantages of having the styles in a separate document is that they can be used by all the HTML pages in a Web site. There is no need to replicate the CSS in the <head> section of each file. You can also then make site-wide changes by editing the single CSS document. Assuming our external CSS document was given a filename of 'styles.css' it would be incorporated into the HTML page in the following way:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Most Web sites use external stylesheets in preference to internal and inline styles because of the advantages they offer in terms of easy site maintenance. Preparing images for the WebImages (graphics and photographs, etc.) can have a huge impact on the appearance of a Web page. However, if images are used poorly and not optimised for the Web then they can just as easily create a bad impression. Images are often much larger in terms of file size than the HTML page that contains them and bigger files take longer to download. As we discovered in the 'Principles of Online Presence' resource a competitor is only a mouse-click away - if your site is slow to load because too many images have been used or they haven't been correctly prepared for use on the Web then your customers are likely to go elsewhere. The three main factors to consider (other than 'Is the image necessary?') when preparing images for the Web are:
Popular image processing software includes:
Further information on preparing images for the Web:
InteractivityAdding interactivity to a business Web site can be an excellent way of encouraging customers to keep returning to the site. Interactivity may take the form of a discussion forum, an online shop, order tracking and even games.
Image: A screen shot of Biz/ed's Interactive Markets resource(http://www.bized.co.uk/learn/economics/markets/mechanism/interactive/part1.htm) Interactivity may be incorporated into a site using a variety of technologies, for example, JavaScript, Macromedia Flash, Java Applets, Perl and PHP scripts. Web developers write computer programs in these formats or languages and these can then be used by a client through their Web browser. Some of these technologies (for example, JavaScript and Macromedia Flash) are downloaded and run by the user's Web browser - these are known as client side technologies, others (for example, PHP and Perl) run on the Web server - these are known as server side technologies. Client side technologies are limited by the client's Web browser. An example would be the Macromedia Flash resources used in Biz/ed's interactive markets resource(http://www.bized.co.uk/learn/economics/markets/mechanism/interactive/part1.htm). Macromedia Flash is a multimedia technology that can be embedded in HTML pages. Flash files can take the form of animations, games and even whole 'Web' sites. Biz/ed primarily uses Flash to produce interactive simulations or animations illustrating a particular theory or concept. Flash files are produced in an authoring tool (also called Macromedia Flash) and these compressed files (with a .swf extension) are embedded in the HTML page. Assuming the Web browser has the Flash plugin (a program that allows Web browsers to display a wider range of content) the animation/simulation is displayed. If a user doesn't have the plugin they will see an annotated diagram instead. Another example of a client side technology is JavaScript. JavaScript (which should not be confused with the Java programming language) is a scripting language that can interact with the HTML code of a Web page. The JavaScript code is embedded within the page itself and so operates on the client side rather than server side. However, if the Web browser cannot run JavaScript (or has JavaScript disabled) then that functionality will not be available to the user. In some cases, the whole navigational structure of a Web site may require JavaScript and, if the site is badly designed, the Web site may be completely useless if JavaScript is not supported by the Web browser. This can have serious financial and legal implications for a business as we will see later. Server side technologies are programs that reside on the Web server. When a user completes a form (for example), the data from that form is sent through what's called the CGI (Common Gateway Interface) which allows a user's Web browser to pass data to the program on the Web server. On receiving the data the program processes it and then, if appropriate, sends an HTML page back to the user. In the case of our Key Economic Data (KED) resource(http://www.bized.co.uk/cgi-bin/ked/ked.pl), students fill in the form depending on the data they require and then press the 'Submit' button. The data from the form is then sent through CGI to a Perl (Practical Extraction and Reporting Language) program residing on the Biz/ed Web server. This program processes the data from the form and connects to a database containing the data for the KED. The Perl script extracts data from the database based on the values filled in by the student. At this stage this data is then used to produce an HTML page which (depending on the display options chosen by the student) contains a graph (also created by the Perl script), a table of values and definitions for the data. The HTML page is then sent back to the student's Web browser. The student can also request the data in Comma Separated Value (CSV) format using the same form. In this instance the Perl script queries the database and produces a CSV file instead of an HTML page. The CGI allows a Web browser to communicate with any program residing in a particular area on the Web server. However, modern scripting languages like PHP (PHP: Hypertext Preprocessor) offer similar functionality to programs accessed through the CGI but integrate more closely with the Web server and do not rely on the CGI. What technology should I use? In general, the answer to this question depends on what you want to do. If you want to produce a highly interactive game then you would usually use client side technology since the delay in sending data back and forth to the server might disrupt the gameplay. However, if you want to allow users to request financial data for a range of companies and that data is held in a database then you'd use server side technologies. In most instances the server side technologies are much more powerful (offer a greater degree of functionality) than the client side technologies. The main functionality of e-commerce software, for example, will use server side technologies. Having decided on the client or server side you then need to decide on the specific technology to use. If your program will need to run on the server you may be limited to a particular range of technologies based on the type of Web server you have access to. For example a Windows Web server will allow you to use VBscript (a scripting language based on Visual Basic) but VBscript will not work on a Unix/Linux-based Web server. Further reading:
e-commerceIn the case of most small businesses their Web site is used solely as a promotional tool. If any e-commerce functionality is present it is likely to be provided by a third party since the costs of developing a bespoke application are prohibitive. Many off-the-shelf e-commerce solutions exist and the Internet Service Provider of the small business may also offer e-commerce facilities as part of its service. In addition, most banks offer e-commerce solutions to businesses. These solutions are a relatively low-cost way to provide an online shop and often they are integrated with business bank accounts so that money from sales is paid directly into the account. In addition to setting up e-commerce facilities it is important that the business has the infrastructure to support this venture. If users buy a product online but must wait weeks for it to be delivered due to stock or staff shortages they are unlikely to return. The ease of shoping online has almost certainly raised the expectations of the customer in terms of turnaround and delivery times. Further reading:
Next stepsView source One of the best ways to learn about Web development is to look at how other developers achieved a particular effect or layout. Most Web browsers have a 'View source' function that allows you to view the HTML source of the Web page you are viewing.
NB: although it is a good idea to improve your HTML skills by viewing the source of other pages you should be aware that not everyone adheres to HTML standards and good practice. When looking at someone else's code you should not adopt any bad practices. In addition the code is automatically copyrighted so you cannot simply replicate a design you like by copying the code. Task 9Visit two of your favourite Web sites and view the source of the homepage. Look for familiar parts of the document including the DTD, <html>, <head> and <body> tags. These tags are all required within an HTML page so, if the site adheres to the Web standards you should be able to find them. HTML We have only met a small number of the tags that are used to produce Web pages. Some excellent sources of further information on HTML are:
A quick note on good practice. During the course of this resource we have used lowercase tags, put quotes around our attributes and correctly closed our tags (so a paragraph starts with <p> but then ends with a </p> for example). Some books and online resources you come across may not adhere to these rules as strictly. We have introduced this good practice to 'future-proof' your code and to promote the practice of writing valid code for reasons we will cover later in the resource. XHTML Earlier in the resource we refered to the Document Type Declaration as a means of identifying the version of HTML being used in your resource. The final version of HTML is 4.01, there will be no HTML 5. HTML has been superseded by XHTML (eXtensible HypeText Markup Language). The specification for XHTML was first released in 2000. However, unlike Biz/ed who adopted XHTML in 2002, the majority of Web sites are still being written using HTML 4 - hence this resource focusing on HTML. The main reason for the slow adoption of XHTML is almost certainly due to the length of time it took for WYSIWYG editors to produce XHTML rather than HTML. Sites being developed using code/text editors could adopt the new standard more quickly. XHTML offers many advantages over HTML, for example, it forces you to write better structured, more efficient and valid code. XHTML properly separates presentation and content and, because of its stricter structure, it's easier for devices to 'read' and therefore support for XHTML will be more common in a wider range of Web enabled devices than HTML. If you've followed the good practice we've outlined above then it is not difficult to convert your HTML documents to XHTML. Sites that use poor HTML markup will find it harder to convert to using XHTML but as browsers and device support for HTML disappears they will be forced to. Further information on XHTML can be found at:
CSS In this resource we have looked at the basics of Cascading Style Sheets, further information can be found here:
Checking your HTML and CSS Both HTML and CSS have specifications that state how and when a tag or selector can be used. It is important that you adhere to these specifications. Failure to do so could cause display/functionality problems (for example, a poorly designed site may only display correctly in one type of browser, users with other browsers may only see a blank screen) and may mean that disabled users cannot use your Web site - we will look at the legal implications of this later in the resource. (http://www.bized.co.uk/educators/16-19/business/marketing/lesson/legal1.htm) Many authoring tools will check your code for you as you write it (although these aren't infallible). A better way of checking your HTML and CSS is to use an online validator. In most cases you can enter the URL of a Web page you want checked in the form and submit the page for checking. However, this will only work if the page is on a Web site already. If your page is offline (as is the case of the pages produced in the tasks above) you can upload the HTML file through a 'browse' option in the validator and copy and paste the CSS code in to the validator form instead. Different validators are required to check your HTML and CSS. The validators will either confirm that your code is correct/valid (adheres to the standards) or will list errors. Two validators commonly used by Web professionals are:
Task 10Validate your HTML pages and CSS code using the validation services above. The validator will indicate any errors. If this is the case try referring back to the notes and wider reading links above to fix the errors. Task 11Using the W3C Markup Validation Service(http://validator.w3.org/) validate the HTML code of the homepage for three Web sites you use regularly (these could be sites your teacher has directed you to or Web sites relating to your interests). If you don't regularly use the Web try validating your school Web site, Biz/ed (http://www.bized.co.uk) and BT (http://www.bt.com). Now answer these questions:
For further information on the importance of Web standards visit the Web Standards Project (WaSP)(http://www.webstandards.org/). Back to An Overview of Business Online |