Website Authoring
Website Authoring
Viewport
The <meta name="viewport" content="width=device-width, initial-scale=1"> a tag
makes your web page display correctly on all devices (desktop, tablet, mobile)
It controls the viewport size and the initial zoom level
Default Target Windows
The target attribute of the <base> the element can set a default target window for
all links on a page
For example, <base target="_blank"> will open all links in a new window or tab
https://www.w3schools.com/tags/tag_meta.asp
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Web Page</title>
<link rel="stylesheet" href="styles.css">
<meta name="description" content="This is my web page">
<meta name="author" content=“John">
<base target="_blank">
</head>
<body>
<h1>Welcome to My Web Page!</h1>
<p>This is a sample paragraph.</p>
</body>
</html>
Creating Body Content
Inserting Objects
• Insert text with elements like <p> for paragraphs and <h1> to <h6> for headings
• Insert images with the <img> element, using the src attribute to specify the image
source
• Use the alt attribute to provide alternate text for images
• Adjust image or video size with the width and height attributes
• Insert sound clips and videos with the <audio> and <video> elements, adding controls
for playback controls, and autoplay to start automatically
<audio controls>
<source src="sound.mp3" type="audio/mpeg">
</audio>
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video
Stylesheet
Using the <div> Tag
The <div> a tag is a container unit which encapsulates other page elements and
divides the HTML document into sections
<div> elements are block level elements and are often used to group elements
to format them with styles
https://www.w3schools.com/html/tryit.asp?
filename=tryhtml_classes_css
<html>
<head>
<style>
.blue-text {
color: blue;
}
.large-font {
font-size: 20px;
}
</style>
</head>
<body>
<div class="blue-text large-font">
<h1>Blue Heading</h1>
<p>Blue paragraph.</p>
<ul style="list-style-type:circle;">
<li>Blue list item 1</li>
<li>Blue list item 2</li>
</ul>
</div>
</body>
</html>
Hyperlink Types
Same-page bookmark: Use the # followed by the id of the element, you want to jump to. Example: <a
href="#section1">Go to Section 1</a>
Locally stored web page: Use the relative path to the file. Example: <a href="contact.html">Contact Us</a>
Email link: Use mailto: followed by the email address. Example: <a href="mailto:example@example.com">Email
Us</a>
Specified location: Use the target attribute to specify where to open the link. _blank for a new tab or window, _self
for the same tab or window, or a named window. Example: <a href="https://www.google.com"
target="_blank">Google</a>
<html>
<body>
<div id="section1">
<h1>This is Section 1</h1>
<a href="#section2">Go to Section 2</a><br>
<a href="contact.html">Contact Us</a><br>
<a href="https://www.google.com"
target="_blank">Google</a><br>
<a href="mailto:example@example.com">Email Us</a>
</div>
<div id="section2">
<h1>This is Section 2</h1>
<a href="#section1">Go back to Section 1</a>
</div>
</body>
</html>
Relative and Absolute File Paths
For instance, if an HTML file and an image are in the same directory, you can reference the image
in the HTML file using just its name (e.g., image.jpg)
It includes the entire path from the root directory to the file or directory in question
For instance, an absolute file path on a Windows system might look like C:\Users\Username\
Documents\image.jpg
Reasons Not to Use Absolute File Paths for Local Objects
Using absolute file paths for local web pages or objects can lead to broken links
when the website is moved to a different directory or server
The web page or object might not exist at the specified location on the server or
the user's computer
If a website is moved or backed up, absolute links will still point to the original
location, not the new or backup location
It is a saved shortcut that directs the browser to
a specific web page.
It stores the title, URL, and favicon of the
corresponding page Allows the user to easily
access favourite locations on the Web
The anchor is a link/placeholder/reference point within the webpage
The anchor links with another part of the web page
Hyperlink is a method of accessing another
document or resource from your current
application.
It can be a Word/phrase/image
When the hyperlink is clicked links to another
document page or either top or bottom of the
page