Presentation is loading. Please wait.

Presentation is loading. Please wait.

Internet & Web Engineering Course Code:CS-228 Credit Hours (3+1) Lab 1 Introduction to Markup Language HTML Instructor: Muhammad Zeeshan Haider.

Similar presentations


Presentation on theme: "Internet & Web Engineering Course Code:CS-228 Credit Hours (3+1) Lab 1 Introduction to Markup Language HTML Instructor: Muhammad Zeeshan Haider."— Presentation transcript:

1 Internet & Web Engineering Course Code:CS Credit Hours (3+1) Lab 1 Introduction to Markup Language HTML Instructor: Muhammad Zeeshan Haider Ali Blog Address:

2 Hyper Text Markup Language

3 HTML HTML is a markup language for describing web documents (web pages). HTML stands for Hyper Text Markup Language A markup language is a set of markup tags HTML documents are described by HTML tags Each HTML tag describes different document content

4 HTML Syntax <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>

5 DOCTYPE The DOCTYPE declaration defines the document type to be HTML

6 Syntax Explaination The text between <html> and </html> describes an HTML document The text between <head> and </head> provides information about the document The text between <title> and </title> provides a title for the document

7 Continued… The text between <body> and </body> describes the visible page content The text between <h1> and </h1> describes a heading. The text between <p> and </p> describes a paragraph

8 Tags <tagname>content</tagname>
HTML tags normally come in pairs like <p> and </p> The first tag in a pair is the start tag, the second tag is the end tag The end tag is written like the start tag, but with a / slash before the tag name

9 Output

10 Write HTML Using Notepad or TextEdit
Step 1: Open Notepad Step 2: Write Some HTML Step 3: Save the HTML Page

11 HTML Headings HTML headings are defined with the <h1> to <h6> tags: <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>

12 Output

13 HTML Paragraphs HTML paragraphs are defined with the <p> tag:
Example: <p>This is a paragraph.</p> <p>This is another paragraph.</p> Output: This is a paragraph.

14 HTML Links HTML links are defined with the <a> tag: Example
<a href=" is a link</a> Output This is a link

15 HTML Images HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), and size (width and height) are provided as attributes: Example <img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142"> Output:

16 The lang Attribute he document language can be declared in the <html> tag. The language is declared in the lang attribute. <html lang="en-US">

17 The title Attribute HTML paragraphs are defined with the <p> tag. In this example, the <p> element has a title attribute. The value of the attribute is "About W3Schools": Example: <p title="About W3Schools"> Output: About W3Schools

18 HTML Horizontal Rules The <hr> tag creates a horizontal line in an HTML page. The hr element can be used to separate content: Example: <p>This is a paragraph.</p> <hr> <p>This is a paragraph.</p> <hr> <p>This is a paragraph.</p>

19 Output

20 The HTML <meta> Element
he HTML <meta> element is also meta data. It can be used to define the character set, and other information about the HTML document. In the chapter about HTML styles you discover more meta elements: The HTML <style> element is used to define internal CSS style sheets. The HTML <link> element is used to define external CSS style sheets.

21 HTML Line Breaks The HTML <br> element defines a line break.
Use <br> if you want a line break (a new line) without starting a new paragraph: Example: <p>This is<br>a para<br>graph with line breaks</p> Output: This is a para graph with line breaks

22 The HTML <pre> Element
The HTML <pre> element defines preformatted text. Example <pre> My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the ocean. Oh, bring back my Bonnie to me. </pre>

23 Output

24 HTML Styling Every HTML element has a default style (background color is white and text color is black). Changing the default style of an HTML element, can be done with the style attribute.

25 Example <body style="background-color:lightgrey"> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body>

26 OUPUT

27 Text Text Color <h1 style="color:blue">This is a heading</h1> Fonts <h1 style="font-family:verdana">This is a heading</h1> Text Size <h1 style="font-size:300%">This is a heading</h1> Text Alignment <h1 style="text-align:center">Centered Heading</h1>

28 Text Formatting Elements
Bold <b> Strong <strong> Italic and Emphasized <i> <em> Small <small> Marked <mark> Deleted <del> Inserted <ins> Subscript <sub> Superscript <sup>

29 Text Formatting some example OUTPUT
This text is bold This text is italic This is superscript

30 Quotations The HTML <q> element defines a short quotation.
Browsers usually insert quotation marks around the <q> element. Example: <p>WWF's goal is to: <q>Build a future where people live in harmony with nature.</q></p> Output: WWF's goal is to: Build a future where people live in harmony with nature.

31 Continued… The HTML <blockquote> element defines a quoted section.

32 Some Other Element The HTML <abbr> element defines an abbreviation or an acronym. Example: <p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p> Output: The WHO was founded in 1948.

33 HTML <bdo> for Bi-Directional Override
The HTML <bdo> element defines bi-directional override. Example: <bdo dir="rtl">This line will be written from right to left</bdo> Output:

34 HTML Computer Code Elements
Keyboard Formatting: The HTML <kbd> element defines keyboard input. Example: <p>To open a file, select:</p> <p><kbd>File | Open...</kbd></p> Output:

35 Continued… Sample Formatting
The HTML <samp> element defines a computer Example: <samp> demo.example.com login: Apr 12 09:10:17 Linux grsec+gg3+e+fhs6b+nfs+gr p3+c4a+gr2b-reslog- v </samp> Output:

36 Continued… Code Formatting
The HTML <code> element defines programming code. Example: <code> var person = { firstName:"John", lastName:"Doe", age:50, eyeColor:"blue" } </code>

37 Output The <code> element does not preserve extra whitespace and line-breaks.

38 Continued… Variable Formatting
The HTML <var> element defines a mathematical variable. Example: <p>Einstein wrote:</p> <p><var>E = m c<sup>2</sup></var></p> Output:

39 Comment Tags Example: <!-- This is a comment --> <p>This is a paragraph.</p> <!-- Remember to add more information here --> Output:

40 Styling HTML with CSS CSS stands for Cascading Style Sheets
Styling can be added to HTML elements in 3 ways: Inline - using a style attribute in HTML elements Internal - using a <style> element in the HTML <head> section External - using one or more external CSS files

41 Example: Output: Styling HTML with CSS
<!DOCTYPE html> <html> <head> <style> body {background-color:lightgray} h1   {color:blue} p    {color:green} </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> Output:

42 Inline Styling (Inline CSS)
Inline styling is useful for applying a unique style to a single HTML element Example <h1 style="color:blue">This is a Blue Heading</h1> Output:

43 Internal Styling (Internal CSS)
An internal style sheet can be used to define a common style for all HTML elements on a page Example: <style> body {background-color:lightgrey} h1   {color:blue} p    {color:green} </style> output:

44 External Styling (External CSS)
External style sheet are ideal when the style is applied to many pages. With external style sheets, you can change the look of an entire web site by changing one file. Example: <head>   <link rel="stylesheet" href="styles.css"> </head> Output:

45 Output: Example: CSS Fonts
<!DOCTYPE html> <html> <head> <style> h1 {     color:blue;     font-family:verdana;     font-size:300%; } p  {     color:red;     font-family:courier;     font-size:160%; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> Output:

46 CSS Box Model CSS border property defines a visible border around an HTML element: Example: p { border:1px solid black; } Ouput:

47 CSS padding The CSS padding property defines a padding (space) inside the border: Example: p {     border:1px solid black;     padding:10px; } Ouput:

48 CSS margin The CSS margin property defines a margin (space) outside the border: Example p {     border:1px solid black;     padding:10px;     margin:30px; } Output:

49 Output: id Attribute: Attributes
All the examples above use CSS to style HTML elements in a general way. To define a special style for one special element, first add an id attribute to the element: Example: <p id="p01">I am different</p> then define a different style for the (identified) element. p#p01 {     color:blue; } Output:

50 Output : class Attribute
To define a style for a special type (class) of elements, add a class attribute to the element: Example: <p class="error">I am different</p> Now you can define a different style for all elements with the specified class: p.error {     color:red; } Output :


Download ppt "Internet & Web Engineering Course Code:CS-228 Credit Hours (3+1) Lab 1 Introduction to Markup Language HTML Instructor: Muhammad Zeeshan Haider."

Similar presentations


Ads by Google