Department of Information Engineering Technology The Superior University, Lahore Web Engineering - I Experiment No.1 Fundamentals of HTML - I Prepared for: __________________ By: Name: ____________ ID: _______________ Section: ___________ Semester: __________ Total Marks: ______________ Obtained Marks: ______________ Signature: ______________ Date: ______________ Web Engineering - I Lab 1 Experiment No.1 Fundamentals of HTML - I (Rubrics) Name: _____________________ ID: ______________________ A. PSYCHOMOTOR Sr. No. 1 2 3 Criteria Allocated Marks Follow Procedures Software and Simulations Accuracy in Output Results Sub Total Unacceptable Poor Fair Good Excellent 1 0% 0 25% 0.25 50% 0.5 75% 0.75 100% 1 2 0 0.5 1 1.5 2 3 0 0.75 1.5 2.25 3 6 Total Obtained Sub Total marks Obtained in Psychomotor(P) B. AFFECTIVE Serial No. Criteria 1 Lab Report 2 Assigned Task Sub-Total Allocated Marks Unacceptable 0% Poor 25% Fair 50% Good 75% Excellent 100% 1 0 0.25 0.5 0.75 1 3 0 0.75 1.5 2.25 3 4 Sub Total Marks Obtained in Affective (A) Total Obtained Instructor Name: _______________ Total Marks (P+A): _______________ Instructor Signature: _______________ Obtained Marks (P+A): _______________ Web Engineering - I Lab 1 Fundamentals of HTML - I 1 OBJECTIVE: This lab is designed to teach the skills to create Web pages using html and tells the browser how to display them. HTML is made up of elements or tags and attributes which work together to identify document parts and tell the browser how to display them. HTML tags to format the appearance of the text on the web page and make it look attractive to the site visitors. Also link tag defines the relationship between the current document and an external resource. Table model allows authors to arrange data into rows and columns of cells. 2 INTRODUCTION OF HTML A web page is a simple text file written in HTML (Hypertext Markup Language). A markup language is a language that describes the content and structure of a document by “marking up” or tagging, different document elements. For example, this lab contains several document elements such as the tutorial title, main headings, subheadings, paragraphs, figures, figure captions, and so forth. Using a markup language, each of these elements could be tagged as a distinct item within the “tutorial document.” Thus, a Hypertext Markup Language is a language that supports both the tagging of distinct document elements and connecting documents through hypertext links. 2.1 HTML BASICS HTML Documents Below is a visualization of an HTML page structure: Figure 1: structure of webpage document Web Engineering - I Lab 1 Note: The content inside the <body> section (the white area above) will be displayed in a browser. The content inside the <title> element will be shown in the browser's title bar or in the page's tab. A Simple HTML Document Example <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph. </p> </body> </html> 2.2 HTML EDITORS HTML Using Notepad or any TextEdit. Follow the steps below to create your first web page with Notepad or any TextEdit. Step 1: Open Notepad (PC) Write Some HTML Figure 2: notepad to write html Save the HTML Page Save the file on your computer. Select File > Save as in the Notepad menu. Name the file "index.htm" . Web Engineering - I Lab 1 Figure 3: saving html with .html extension View the HTML Page in Your Browser Open the saved HTML file in your favorite browser (double click on the file, or right-click - and choose "Open with"). The result will look much like this: Figure 4: view html page in browser 2.3 ELEMENTS AND ATTRIBUTES HTML elements are written with a start tag, with an end tag, with the content in between: <tagname> content </tagname> Nested HTML Elements <body> <h1>Dummy Text</h1> <p>Lorem ipsum dolor</p> </body> HTML Attributes HTML elements can have attributes Attributes provide additional information about an element Attributes are always specified in the start tag Web Engineering - I Lab 1 Attributes come in name/value pairs like: name="value" The href Attribute HTML links are defined with the <a> tag. The link address is specified in the href attribute: Example <a href="http://www.google.com">This is a link</a> The src Attribute The <img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed: Example <img src="img_girl.jpg"> 2.4 HTML HEADINGS HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important heading. <h6> defines the least important heading: Example <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> <h4>This is heading 4</h4> <h5>This is heading 5</h5> <h6>This is heading 6</h6> Figure 5: different headings in html 2.5 HTML PARAGRAPHS HTML paragraphs are defined with the <p> tag: Example <p>This is a paragraph.</p> <p>This is another paragraph.</p> A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph. Web Engineering - I Lab 1 2.6 THE HTML <PRE> ELEMENT The HTML <pre> element defines preformatted text. The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks: Example <pre> My Bonnie lies over the ocean. Oh, bring back my Bonnie to me. </pre> 2.7 HTML STYLES The HTML style attribute is used to add styles to an element, such as color, font, size, and more. The HTML style attribute has the following syntax: <tagname style="property:value;"> The property is a CSS property. The value is a CSS value. Background Color The CSS background-color property defines the background color for an HTML element. Example: <body style="background-color:powderblue;"> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> Text Color The CSS color property defines the text color for an HTML element: Example <h1 style="color:blue;">This is a heading</h1> <p style="color:red;">This is a paragraph.</p> Fonts The CSS font-family property defines the font to be used for an HTML element: Example <h1 style="font-family:verdana;">This is a heading</h1> <p style="font-family:courier;">This is a paragraph.</p> Text Size The CSS font-size property defines the text size for an HTML element: Web Engineering - I Lab 1 Example <h1 style="font-size:300%;">This is a heading</h1> <p style="font-size:160%;">This is a paragraph.</p> Text Alignment The CSS text-align property defines the horizontal text alignment for an HTML element: Example <h1 style="text-align:center;">Centered Heading</h1> <p style="text-align:center;">Centered paragraph.</p> 2.8 HTML TEXT FORMATTING HTML contains several elements for defining text with a special meaning. HTML Formatting Elements Formatting elements were designed to display special types of text: <b> - Bold text <strong> - Important text <i> - Italic text <em> - Emphasized text <mark> - Marked text <small> - Smaller text <del> - Deleted text <ins> - Inserted text <sub> - Subscript text <sup> - Superscript text 2.9 HTML QUOTATION AND CITATION ELEMENTS we will go through the <blockquote>,<q>, <abbr>, <address>, <cite>, and <bdo> HTML elements. I. HTML <blockquote> for Quotations The HTML <blockquote> element defines a section that is quoted from another source. Browsers usually indent <blockquote> elements. <p>Here is a quote from WWF's website:</p> <blockquote cite="http://www.worldwildlife.org/who/index.html"> For 60 years, WWF has worked to help people and nature thrive. As the world's leading conservation organization, WWF works in nearly 100 countries. </blockquote> II. HTML <q> for Short Quotations The HTML <q> tag defines a short quotation. Web Engineering - I Lab 1 Browsers normally insert quotation marks around the quotation. <p>WWF's goal is to: <q>Build a future where people live in harmony with nature.</q></p> III. HTML <abbr> for Abbreviations The HTML <abbr> tag defines an abbreviation or an acronym, like "HTML", "CSS", "Mr.", "Dr.", "ASAP", "ATM". Marking abbreviations can give useful information to browsers, translation systems and search-engines. <p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p> IV. HTML <address> for Contact Information The HTML <address> tag defines the contact information for the author/owner of a document or an article. The contact information can be an email address, URL, physical address, phone number, social media handle, etc. The text in the <address> element usually renders in italic, and browsers will always add a line break before and after the <address> element. <address> Written by John Doe.<br> Visit us at:<br> Example.com<br> Box 564, Disneyland<br> USA </address> V. HTML <cite> for Work Title The HTML <cite> tag defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.). Note: A person's name is not the title of a work. The text in the <cite> element usually renders in italic. <p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p> VI. HTML <bdo> for Bi-Directional Override BDO stands for Bi-Directional Override. The HTML <bdo> tag is used to override the current text direction: <bdo dir="rtl">This text will be written from right to left</bdo> 2.10 HTML COMMENTS HTML comments are not displayed in the browser, but they can help document your HTML source code. HTML Comment Tag <! -- Write your comments here --> Web Engineering - I Lab 1 2.11 HTML LINKS - HYPERLINKS HTML links are hyperlinks. create a hyperlink between (documents or parts of a document). 1. HTML Links - Syntax The HTML <a> tag defines a hyperlink. It has the following syntax: <a href="url">link text</a> 2. HTML Links - The target Attribute By default, the linked page will be displayed in the current browser window. To change this, you must specify another target for the link. The target attribute specifies where to open the linked document. The target attribute can have one of the following values: _self - Default. Opens the document in the same window/tab as it was clicked _blank - Opens the document in a new window or tab _parent - Opens the document in the parent frame _top - Opens the document in the full body of the window Example Use target=”_blank” to open the linked document in a new browser window or tab: <a href="https://www.youtube.com/" target="_blank">Visit youtube!</a> 3. Link to an Email Address Use mailto: inside the href attribute to create a link that opens the user's email program (to let them send a new email): <a href="mailto:someone@example.com">Send email</a> 4. Link Titles The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element. <a href="https://www.youtube.com/html/" title="Go to youtube ">Visit youtube</a> 2.12 HTML TABLES HTML tables allow web developers to arrange data into rows and columns. Web Engineering - I Lab 1 Company Contact Country Alfreds Maria anders Germany Centro commercial Francisco Mexico 1. Table Cells by Each table cell is defined a <td> and a </td> tag. Td stands for table data. Everything between <td> and </td> are the content of the table cell. 2. Table Rows Each table row starts with a <tr> and ends with a </tr> tag. tr stands for table row. 3. Table Headers Sometimes you want your cells to be table header cells. In those cases use the <th> tag instead of the <td> tag: th stands for table header Example <table> <tr> <th>Company</th> <th>Contact</th> <th>Country</th> </tr> <tr> <td>Alfreds Futterkiste</td> <td>Maria Anders</td> <td>Germany</td> </tr> <tr> <td>Centro comercial Moctezuma</td> <td>Francisco Chang</td> <td>Mexico</td> </tr> </table> HTML Table Colspan & Rowsapn HTML tables can have cells that span over multiple rows and/or columns. Web Engineering - I Lab 1 2022 NAME APRIL FIESTA HTML Table - Colspan To make a cell span over multiple columns, use the colspan attribute: <table> <tr> <th colspan="2">Name</th> <th>Age</th> </tr> <tr> <td>Jill</td> <td>Smith</td> <td>43</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>57</td> </tr> </table> HTML Table - Rowspan To make a cell span over multiple rows, use the rowspan attribute: <table> <tr> <th>Name</th> <td>Jill</td> </tr> <tr> <th rowspan="2">Phone</th> <td>555-1234</td> </tr> <tr> <td>555-8745</td> </tr> </table> Web Engineering - I Lab 1 3 LAB TASKS Solve the following tasks. 3.1 TASK 1 Provide the code to mark the following list of the top-five most popular movies ranked in IMDB. 3.2 TASK 2 Create a page to show different character formatting (B, I, U, SUB, SUP) tags. Print the below line. 3.3 TASK 3 Create the following table in HTML and fill your data in it as well: 3.4 TASK 4 Use HTML table tag to create a calendar of your birth month, also bold the weekdays in calendar and highlight your birthdate in calendar. 3.5 TASK 5 Write HTML code to create a Web Page that contains an Image at its center. Also mention heading on page and add your name and roll no. as well. Web Engineering - I Lab 1 4 HOME ASSIGNMENT 4.1 TASK 1 Create an html page containing the polynomial expression as follows. 4.2 TASK 2 Create the following table in HTML and fill your data in it as well: 4.3 TASK 3 Design a page having suitable background color and text color with title “My First Web Page” using all the attributes of the Font tag.
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )