Chapter 8 - Web Development with HTML, CSS, and JavaScript

Comprehensive Questions & Answers for Class 9 Computer Science (Punjab Board)

Class 9 Computer Science Punjab Board
Q1
Answer:

The <head> tag contains meta-information about the HTML document, like the title, styles, and links to external resources.

Q2
Answer:
Ordered List Unordered List
Definition: An ordered list keeps each list item with an order number. If you change the order, the meaning of the whole list may also change. Definition: In an unordered list, the order of the list items is not important. In other words, shuffling of items in an unordered list has no effect.
Structure

Ordered List (<ol>) displays items in a numbered sequence; a.b.c or i, ii, iii.

Unordered Lists uses bullet points.  •

Example

If your teacher makes a list of students with respect to their marks,  definitely order will matter.

List of cities in Pakistan.
Q3
Answer:

Comment in CSS are added using // for single line comment and /* comment */ for multiple line comment.

Q4
Answer:

CSS can be applied via inline styles, internal styles in the <style> tag, or external styles using a linked CSS file.

Q5
Answer:

JavaScript can be included using the <script> tag, either inline within the HTML or linked to an external JavaScript file.

Q6
Answer:

Hyperlink is created using anchor tag <a>. The href attribute defines the destination URL.

Syntax:

<a href="URL">Link Text</a>

Example:

<a href="https://www.google.com">Click Here</a>

Q7
Answer:

The <div> tag is a container used to group elements and apply styles or layouts.

Q8
Answer:

We can link an external CSS file to an HTML document by using the <link> tag in the <head> section:
<link rel="stylesheet" href="style.css">

Q9
Answer:

The <table> tag is used to create and display tabular data in rows and columns.

Q10
Answer:

The box model describes the structure of an element consisting of content, padding, border, and margin.

Margins and padding:
Margins and padding are used to create space around and inside elements. Margins create space outside the elements while padding creates space inside the elements.
Example:

box {
  margin: 20px;
  padding: 10px;
  background-color: lightgrey;
}