HTML Part 2
The syntax for id is: write a hash character (___), followed by an id name. Then, define the CSS properties within ________.
(#) curly braces { }
create a book mark for the id attribute Then, add a link to the bookmark ("Jump to Chapter 4"), from within the same page: Or, add a link to the bookmark ("Jump to Chapter 4"), from another page:
<h2 id="C4">Chapter 4</h2> <a href="#C4">Jump to Chapter 4</a> <a href="html_demo.html#C4">Jump to Chapter 4</a>
What is the syntax for an iframe?
<iframe src="url" title="description">
The HTML ---- tag specifies an inline frame.
<iframe>
element that defines an inline frame
<iframe>
In the following example, the file path points to a file in the images folder located in the folder one level up from the current folder:
<img src="../images/picture.jpg" alt="Mountain">
The "picture.jpg" file is located in the folder one level up from the current folder
<img src="../picture.jpg">
The "picture.jpg" file is located in the images folder at the root of the current web
<img src="/images/picture.jpg">
Show an absolute file path
<img src="https://www.w3schools.com/images/picture.jpg" alt="Mountain">
In the following example, the file path points to a file in the images folder located in the current folder:
<img src="images/picture.jpg" alt="Mountain">
The "picture.jpg" file is located in the images folder in the current folder
<img src="images/picture.jpg">
The "picture.jpg" file is located in the same folder as the current page
<img src="picture.jpg">
Show a CSS HTML Link tag
<link rel="stylesheet" href="mystyle.css">
The HTML <---> tag defines an alternate content to be displayed to users that have disabled scripts in their browser or have a browser that doesn't support scripts:
<nonscript>
defines a title in the browser toolbar provides a title for the page when it is added to favorites displays a title for the page in search engine-results
<title>
The HTML <head> element is a container for the following elements:
<title>, <style>, <meta>, <link>, <scipt>, and <base>
What is the difference between a class and an id?
A class name can be used by multiple HTML elements, while an id name must only be used by one HTML element within the page:
The class name can also be used by JavaScript to perform certain tasks for specific elements. JavaScript can access elements with a specific class name with the get
ElementsByClassName( ) method:
JavaScript can access elements with a specific class name with the get______
ElementsByClassName() method
The class attribute can be used on any _____
HTML element
makes HTML pages more dynamic and interactive.
Javascript
Notes for Iframe
The HTML <iframe> tag specifies an inline frame The src attribute defines the URL of the page to embed Always include a title attribute (for screen readers) The height and width attributes specifies the size of the iframe Use border:none; to remove the border around the iframe
Read how to use an id attribute
The id attribute is used by CSS and JavaScript to style/select a specific element The value of the id attribute is case sensitive The id attribute is also used to create HTML bookmarks JavaScript can access an element with a specific id with the getElementById() method
The class name is _____
case sensitive
The HTML_______ attribute is used to specify a class for an HTML element. This attribute is often used to point to a class name in a style sheet. It can also be used by a JavaScript to access and manipulate elements with the specific class name.
class
_____ are used by CSS and JavaScript to select and access specific elements
classes
Use the --- and --- attributes to specify the size of the iframe. The height and width are specified in ---- by default:
height, width, pixels
The HTML ___attribute is used to specify a unique id for an HTML element.
id
The __ attribute specifies a unique id for an HTML element. The value of the __ attribute must be unique within the HTML document. This attribute is used to point to a specific style declaration in a style sheet. It is also used by JavaScript to access and manipulate the element with the specific id.
id
An HTML _____ is used to display a web page within a web page. is is used to embed another document within the current HTML document.
iframe
A ---- file path points to a file relative to the current page. In the following example, the file path points to a file in the images folder located at the root of the current web:
relative
Tip: It is a good practice to always include a _____attribute for the <iframe>. This is used by screen readers to read out what the content of the iframe is.
tittle