Advanced Web Design: Notes
- Categories Web Designing
This post contains notes on Advanced Web Design in a question and answer format which will help you better understand the chapter.
- What is an HTML form?
An HTML form is used to collect user input. This is then further used for processing. In HTML the <form> element is the container which has different types of input elements.
So each form has one <form> element and has multiple <Input> elements inside it.
e.g.
<form>
<Input>
<Input>
….. more as needed ….
</form>
- What are the elements that are included in the form, other than <input>?
Tag | Description |
<textarea> | Defines a multiline input control (text area) |
<label> | Defines a label for an <input> element |
<fieldset> | Groups related elements in a form |
<legend> | Defines a caption for a <fieldset> element |
<select> | Defines a drop-down list |
<optgroup> | Defines a group of related options in a drop-down list |
<option> | Defines an option in a drop-down list |
<button> | Defines a clickable button |
<datalist> | Specifies a list of pre-defined options for input controls |
<output> | Defines the result of a calculation |
e.g. usage.
- <label for=”fname”>First name:</label>
<input type=”text” id=”firstname” name=”firstname”>
- <select id=”cars” name=”cars” size=”4″multiple>
<option value=”volvo”>Volvo</option>
<option value=”saab”>Saab</option>
</select>
- <textarea name=”message” rows=”10″ cols=”30″>
The cat was playing in the garden.
</textarea>
- <button type=”button” onclick=”alert(‘Hello World!’)”>Click Me!</button>
- <fieldset>
<legend>Personalia:</legend>
<input type=”text” id=”lname” name=”lname” value=”Doe”><br><br>
<input type=”submit” value=”Submit”>
</fieldset>
- What is an input element?
An input element is used along with the form element. Depending upon the type attribute, different types of fields can be displayed on the screen.
- What are different values that type attribute can have in <input> element?
type=“ “ | Description |
Text | Defines a one-line text input field |
password | Defines a one-line password input field |
submit | Defines a submit button to submit the form to server |
Reset | Defines a reset button to reset all values in the form. |
Radio | Defines a radio button which allows select one option. |
checkbox | Defines checkboxes which allow select multiple options form. |
Button | Defines a simple push button, which can be programmed to perform a task on an event. |
File | Defines to select the file from device storage. |
Image | Defines a graphical submit button. |
Color | Defines an input field with a specific color. |
Date | Defines an input field for selection of date. |
datetime-local | Defines an input field for entering a date without time zone. |
Defines an input field for entering an email address. | |
Month | Defines a control with month and year, without time zone. |
number | Defines an input field to enter a number. |
url | Defines a field for entering URL |
Week | Defines a field to enter the date with week-year, without time zone. |
Search | Defines a single line text field for entering a search string. |
tel | Defines an input field for entering the telephone number. |
e.g. usage
<form>
<label>Enter User name</label><br>
<input type=”text” name=”firstname”><br>
<label>Enter Password</label><br>
<input type=”Password” name=”password”><br>
<input type=”radio” name=”color” value=”red”> Red <br>
<input type=”checkbox” name=”sport1″ value=”cricket”>Cricket<br>
<input type=”file” name=”newfile”>
<input type=”image” alt=”Submit” src=”login.png” width=”100px”>
<br><input type=”submit” value=”submit”>
<input type=”button” value=”Click me ” onclick=”alert(‘you are learning HTML’)”>
</form>
- What are the different attributes of input element?
Attribute | Description |
checked | Specifies that an input field should be pre-selected when the page loads (for type=”checkbox” or type=”radio”) |
disabled | Specifies that an input field should be disabled |
Max | Specifies the maximum value for an input field |
maxlength | Specifies the maximum number of character for an input field |
Min | Specifies the minimum value for an input field |
pattern | Specifies a regular expression to check the input value against |
readonly | Specifies that an input field is read only (cannot be changed) |
required | Specifies that an input field is required (must be filled out) |
Size | Specifies the width (in characters) of an input field |
Step | Specifies the legal number intervals for an input field |
Value | Specifies the default value for an input field |
e.g.
<input type=”text” id=”cc” name=”country_code” pattern=”[A-Za-z]{3}” title=”Three letter code”>
<input type=”tel” name=”phone” pattern=”[0-9]{10}” required>
Audio and Video in HTML
- What is <Audio> Tag?
- The <audio> tag is used to embed sound content in a document, such as music or other audio streams.
- The <audio> tag contains one or more <source>tags with different audio sources. The browser will choose the first source it supports.
- The text between the <audio> and </audio> tags will only be displayed in browsers that do not support the <audio> element.
- What are the supporting audio formats in HTML?
Below are the supported audio formats in HTML:
- MP3 – Audio format from MPEG (Moving/Motion Pictures Experts Group)
- AAC – Advanced Audio Coding
- OGG – An Open container and free audio format
E.g.
<audio controls autoplay>
<source src=”horse.ogg” type=”audio/ogg”>
<source src=”horse.mp3″ type=”audio/mpeg”>
Your browser does not support the audio tag.
</audio>
- What are the attributes of audio tag?
Attribute | Value | Description |
autoplay | autoplay | Specifies that the audio will start playing as soon as it is ready |
controls | controls | Specifies that audio controls should be displayed (such as a play/pause button etc) |
loop | loop | Specifies that the audio will start over again, every time it is finished |
muted | muted | Specifies that the audio output should be muted |
preload | auto | Specifies if and how the author thinks the audio should be loaded when the page loads |
- What is the <video> tag?
- The <video> tag is used to embed video content in a document, such as a movie clip or other video streams.
- The <video> tag contains one or more <source> tags with different video sources. The browser will choose the first source it supports.
- The text between the <video> and </video> tags will only be displayed in browsers that do not support the <video> element.
- SYNTAX : <video src=”URL” controls></video>
- What are the supported file formats for video tag?
There are three supported video formats in HTML: MP4, WebM, and OGG.
- What are the different attributes of video tag?
Attribute | Value | Description |
autoplay | autoplay | Specifies that the video will start playing as soon as it is ready |
controls | controls | Specifies that video controls should be displayed (such as a play/pause button etc). |
height | pixels | Sets the height of the video player |
loop | Loop | Specifies that the video will start over again, every time it is finished |
muted | muted | Specifies that the audio output of the video should be muted |
poster | URL | Specifies an image to be shown while the video is downloading, or until the user hits the play button |
preload | auto | Specifies if and how the author thinks the video should be loaded when the page loads |
src | URL | Specifies the URL of the video file |
width | pixels | Sets the width of the video player |
- What is an image map in HTML?
- An image with multiple hyperlinks is called an image map.
- An image map is created by marking certain regions on an image clickable. These clickable regions are called as hotspots.
- The HTML <map> tag defines an image map. The image areas are defined with one or more <area> tags.
- What are the different tags used to create an image map?
<Img> : It is used to insert an image on a web page. To create image map, usemap attribute of <img> is used with a value which is preceded with a # symbol. The usemap attribute acts as a pointer which indicates that the image is a image map.
<map> : It has only one attribute: name. It specifies name of the image used for client side image map. The value of the name attribute is the value specified in usemap attribute of <img>.
<area> : It defines specific clickable regions. A given <map> element can contain multiple <area> elements within it.
e.g.
<img src=”workplace.jpg” alt=”Workplace” usemap=”#workmap”>
<map name=”workmap”>
<area shape=”rect” coords=”34,44,270,350″ alt=”Computer” href=”computer.htm”>
<area shape=”circle” coords=”337,300,44″ alt=”Coffee” href=”coffee.htm”>
<area shape=”poly” coords=”145,187,198,215,245,280,305″ href=”tri.htm “/>
</map>
- What are the attributes of the <area> tag?
Attribute | Value | Description |
alt | text | Specifies an alternate text for the area. Required if the href attribute is present |
coords | coordinates | Specifies the coordinates of the area |
download | filename | Specifies that the target will be downloaded when a user clicks on the hyperlink |
href | URL | Specifies the hyperlink target for the area |
shape | default | Specifies the shape of the area |
- What is an <iframe> tag?
- The <iframe> tag specifies an inline frame.
- An inline frame is used to embed another document within the current HTML document.
- e.g. when doing advertising.
- Syntax: <iframe src=”https://simplycoding.in” title=“SimplyCoding”></iframe>
- What are the attributes of <iframe> tag?
Attribute | Value | Description |
height | pixels | Specifies the height of an <iframe>. Default height is 150 pixels |
name | text | Specifies the name of an <iframe> |
src | URL | Specifies the address of the document to embed in the <iframe> |
srcdoc | HTML_code | Specifies the HTML content of the page to show in the <iframe> |
width | Pixels | Specifies the width of an <iframe>. Default width is 300 pixels |
- What is a frameset tag in HTML?
HTML frames are used to divide your browser window into multiple sections where each section can load a separate HTML document. A collection of frames in the browser window is known as a frameset. The window is divided into frames in a similar way the tables are organized: into rows and columns.
e.g.
<frameset rows = “10%,80%,10%”>
<frame name = “top” src = “/html/top_frame.htm” />
<frame name = “bottom” src = “/html/bottom_frame.htm” />
<noframes>
<body>Your browser does not support frames.</body>
</noframes>
</frameset>
- What is the <header> element in HTML?
The <header> element represents a container for introductory content or a set of navigational links.
A <header> element typically contains:
- one or more heading elements (<h1> – <h6>)
- logo or icon
- authorship information
- What is the nav element in HTML?
- The <nav> tag defines a set of navigation links.
- NOT all links of a document should be inside a <nav> element. The <nav> element is intended only for major block of navigation links.
- What is the footer element in HTML?
- The <footer> tag defines a footer for a document or section.
- A <footer> element typically contains:
- authorship information
- copyright information
- contact information
- sitemap
- back to top links
- related documents
- What is the <article> tag in HTML?
- The <article> tag specifies independent, self-contained content.
- An article should make sense on its own and it should be possible to distribute it independently from the rest of the site.
- Potential sources for the <article> element:
- Forum post
- Blog post
- News story
- What is the <aside> tag in HTML?
- The <aside> tag defines some content aside from the content it is placed in.
- The aside content should be indirectly related to the surrounding content.
- g. The <aside> content is often placed as a sidebar in a document.
- What is the <div> tag in HTML?
- The <div> tag defines a division or a section in an HTML document.
- The <div> tag is used as a container for HTML elements – which is then styled with CSS or manipulated with JavaScript.
- The <div> tag is easily styled by using the class or id attribute.