Html And Css

  • Uploaded by: api-3835536
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Html And Css as PDF for free.

More details

  • Words: 3,066
  • Pages: 50
Content 

Html Introduction



Html Tags – IMG, Form, Hyperlinks, Frames, Tables



Exercise



Cascading Style Sheets – Introduction



Advantages of CSS



Types of Style Sheets



Selectors



Key Concepts



Example

Introduction [Contd…] 

Web Browser ➨ Establishes the connection to the specified Web server, at the requested URL (Uniform Resource Locator (URL) ➨ Interprets and formats the information found on the server, and displays the formatted information.



Web Server ➨ A computer that delivers/serves Web pages. ➨ Every Web server has an IP address and possibly a domain name. E.g:I f you enter the URL http://www.yahoo.com/index.html in your browser, this sends a request to the server whose domain name is yahoo.com. The server then fetches the page named index.html and sends it to your browser. ➨ Each Web server contains documents that are written in the Hypertext Markup Language (HTML) Requests and responses are exchanged between Web browsers and Webservers using the Hypertext Transfer Protocol (HTTP)

Introduction [Contd…] 

Hypertext Transfer Protocol (HTTP) stateless, application level protocol.

HTTP defines how the browser establishes connection to the server the browser requests information from the server the server responds to the browser’s request the server/browser closes the connection

Works on Client-Server architecture

Introduction [Contd…] 

Hypertext Markup Language(HTML) ➨



a simple markup language used to define and describe the layout of a web page

Uniform Resource Locator(URL) ➨

standard identifier used to locate information on the Web



elements in a URL – protocol://domain name/filename ➨

hypertext protocol – http://www.microsoft.com/index.html



file transfer protocol – ftp://ftp.dartmouth.org

URL Basics 

A uniform resource locator, commonly abbreviated as URL specifies the location of the resource on the internet/intranet or a web application.



URL types:





Absolute URLs



Relative URLs



Fragment URLs

Absolute URLs Absolute URLs use a complete Internet address to give the location of a resource. ➨ Examples: ➨

http://msdn.microsoft.com/support/index.asp http://msdn.microsoft.com/code/welcome.asp?frame=true

URL Basics 

Relative URLs Relative URLs are used for accessing files when the full Internet address is unnecessary. ➨ Examples: ➨

index.asp /index.asp welcome.asp?frame=true



Fragment URLs Fragment URLs are used to access to a specific location within a URL. ➨ Examples: ➨

http://www.someplace.com/shopping.html#books

Introduction - HTML Tags 

HTML Tags are enclosed in angle brackets,



Attributes are commands added to the tags to specify various options.



Any HTML file should start with the tag and end with the tag



The text between the start and end tags is the element content ➨



HTML tags are not case sensitive, means the same as

HTML file is saved with the extension htm or html ➨

That is filename.htm or filename.html

Introduction - HTML Tags [Contd…] Simple HTML for example, <TITLE>My First HTML Page This is my first HTML Assignment. I should do it correctly.

Introduction - HTML Tags [Contd…] Tag with attributes <TITLE>My First HTML Page This HTML page is designed to explain the attributes of the body tag.

bgcolor and text are the attributes of the body tag.

bgcolor="#cccccc" indicates the background color of the html page.
text="#660000" indicates the color of the text.

Using Hyperlinks and Anchors 



Uses of Hyperlinks: ➨

Connecting to other HTML pages that are part of a web site or to related material from other Web sites.



Connecting to non-HTML resources, including portable documents such as Adobe Acrobat PDF files or video clips such as QuickTime movies.

Structure of Hyperlinks: ➨

URL description where, http://www.linkfinder.com/ is an URL and is the anchor tag.



Code: Download Adobe Acrobat Reader Output: Download Adobe Acrobat Reader

Adding Images to a Web Page 

tag is used to include an image in the web document.



Example Code: Output:

Creating HTML tables 

Table is a system of columns and rows.



Using tables you can control precisely how you want your content divided up and where you want it placed.



To create a HTML use a

tag and its attributes.



Each row of a table is specified using a tag.



Each cell of a table is specified using a
tag.



Table heading is specified using a
tag.

Tables [Contd…] Eg.
Year Amount
2002 85,000
2001 65,000


Year

Amount

2002

85,000

2001

65,000

Specifying rowspan and colspan Specifying Colspan

Heading

Heading
One Two

One

Two



Specifying Rowspan
One Two
Three


One

Two Three

Frames [Contd…]    

Any link in one frame can open a page in another frame. Accomplish this by using the name attribute of the tag and the target attribute of the tag. The name attribute gives each frame an identity as whatever name you choose. Refer the frame name in the target attribute of the tag

frame.html toolbar.html
home products about us feedback

Frames [Contd…] 

toolbar.html and index.html

Using Forms in HTML [Contd…] 

Introduction ➨



HTML Forms act as an Interface between the End User and the server side Application. At client side the form is filled and data is passed on to the server, where the data is interpreted and used accordingly.

Different Elements ➨

Form



Input



Select and Option



Textarea



Others [Button, Label, Fieldset and Legend]

Using Forms in HTML [Contd…] 

Form Element ➨

The form has got two main attributes viz.. Action and Method.



Action attribute is required. Methods are ‘get’ which is default and ‘post’



Other attributes define the encoding type and event handlers[javascript/vbscript]



Here is an eg. of Form tag

The action attribute has the url to which the Form data has to go

Using Forms in HTML [Contd…] ➨

The GET method submits the name/value pairs to the URL specified in action attribute appending to the URL. eg urlname?FirstName=value&SecondName=value



This can be seen on the browser’s address bar



The method POST submits the data as part of HTML Body



The ENCTYPE is used to state the encoding type of the form contents. Default being ‘application/x-www-form-urlencoded’.



There are two attributes[onSubmit and onReset] which are used w.r.t scripting is concerned. The ONSUBMIT event is triggered when a submit button is clicked and from here the control can be passed on to any function of a script ➨ eg. javascript or vbscript Usage:
----


Using Forms in HTML [Contd…] ➨ ➨



Basically this can be used whenever we want to invoke a javascript/vbscript function on clicking on a ‘Submit’ button

Whenever we use any form element in a web page it must be with in
tags.

Input Elements ➨

button – Used to invoke a script function or to play around the controls of form elements



checkbox - Off/on



file - Used for selecting user-selecting file



hidden – to hold hidden form elements which do not appear on the web page



image – to make an image as equivalent to a Submit button



password – to Mask the input entry



radio – one entry choosing



Reset – reset the form elements’ values

Using Forms in HTML [Contd…] 



Hidden ➨

The hidden value enables to submit form information that’s invisible to the user on the web page.



Eg.

Image ➨

This is same as a ‘Submit’ button, but the only difference is that it replaces the stark Submit button with an Image. Otherwise it has the same function.



Eg.

Using Forms in HTML [Contd…] 

Password ➨

This is an input control where the text is masked with an asterisk. Otherwise its similar to a text box.



Eg.

Using Forms in HTML [Contd…] 

Submit ➨

This is used to send the name/value pairs of the active form elements to the URL



Specified in the FORM declaration

HTML specification enables multiple Submit buttons ➨ Its declared as



Text This can be used to enter text of a single-line in a text box ➨ Eg.
maxlength=”20”> ➨

The ‘size’ attribute sets the length of the text box



The ‘maxlength’ attribute limits[No. of characters] the user for typing text



One more attribute is ’readonly’. This locks the cursor on focus of the text box and does not allow the user to type any text

Using Forms in HTML [Contd…] 

Select and Option Elements ➨

The SELECT element is used to create a list of choices either as a drop-down menu or a list box. Each of the choices in the list is an OPTION element

<SELECT name=”controlName” size=”controlWidth” onChange=script>

onChange is an event for Select box and directs the flow control to the specified script function.



The default value if not specified explicitly for an option tag would be its content.



The attribute selected leaves that option highlighted

Using Forms in HTML [Contd…] 

Text Area Element ➨

The textarea element is similar to the INPUT element’s text type. But in this case the user can type a larger section of text than they can with the text boxes



It’s a multiple line text input.