0% found this document useful (0 votes)
8 views3 pages

HTML Basics: Elements, CSS, and JavaScript

Uploaded by

karkuvelraj790
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

HTML Basics: Elements, CSS, and JavaScript

Uploaded by

karkuvelraj790
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. List and explain the three flavors of HTML.

The three flavors of HTML are:


1. HTML – The standard HyperText Markup Language.
2. XHTML – A stricter, XML-based version of HTML.
3. HTML5 – The latest version with support for multimedia, graphics, and semantic elements.

2. List and explain any two HTML elements.


<p> – Defines a paragraph.
<img> – Embeds an image in the webpage.

3. Create two rows of horizontal frames using HTML frames.


<frameset rows="50%,50%">
<frame src="[Link]">
<frame src="[Link]">
</frameset>

4. Write HTML code to display an image.


<img src="[Link]" alt="Description" width="300" height="200">

5. How will you create a password field in a HTML form?


<input type="password" name="userpass">

6. Write HTML code to create the table W X / Y Z


<table border="1">
<tr><td>W</td><td>X</td></tr>
<tr><td>Y</td><td>Z</td></tr>
</table>

7. Model the syntax to display the statement 'I am learning Web Programming'
<p>I am learning Web Programming</p>

8. Discover how a scripting language differs from HTML?


HTML is used for structuring content, while scripting languages like JavaScript are used to add
interactivity and dynamic behavior.

9. Give the syntax of a CSS rule


selector { property: value; }

10. Mention the need for cascading style sheets.


CSS is needed to separate content from presentation, improve design consistency, and make
maintenance easier.

11. Give example for inline style sheet.


<p style="color:red;">This is red text</p>

12. How will you include CSS in a website?


Three ways:
1. Inline CSS using style attribute.
2. Internal CSS using <style> tag.
3. External CSS using <link> tag.

13. Give some advantages of using Cascading Style Sheets.


- Consistent design
- Faster page loading
- Easier maintenance
- Device adaptability

14. How external style sheet is useful in web page design?


It allows a single CSS file to control the appearance of multiple web pages, making updates easier.

15. List the two forms of style rules with example


Inline style: <p style="color:blue;">Blue text</p>
External style: p { color: blue; } in a .css file

16. What is a JavaScript statement? Give an example


A JavaScript statement is an instruction that the browser executes.
Example: let x = 10;

17. Write the JavaScript to print “Good Day” using IF-ELSE condition
if (true) {
[Link]("Good Day");
} else {
[Link]("Hello");
}

18. Compile the limitations of CSS.


- Limited logic capability
- Browser compatibility issues
- No dynamic behavior without JavaScript

19. What is DOM?


DOM (Document Object Model) is a programming interface for HTML and XML documents,
representing the page structure as objects.

20. Enlist any four mouse events.


onclick, ondblclick, onmouseover, onmouseout

21. Write a JavaScript program to create table.


let table = "<table border='1'>";
for (let i=0; i<2; i++) {
table += "<tr><td>Row " + (i+1) + "</td></tr>";
}
table += "</table>";
[Link](table);

22. What are internal and external links


Internal links navigate within the same website, external links point to a different website.

23. What is the anchor tag used for


The <a> tag is used to create hyperlinks.

24. Explain checkbox control with suitable example


Checkbox allows multiple selections.
Example: <input type="checkbox" name="vehicle" value="Car"> Car

25. Explain radio button with suitable example


Radio buttons allow only one selection.
Example: <input type="radio" name="gender" value="Male"> Male

26. How to loop an array in JavaScript? Give example


let arr = [1,2,3];
for (let i=0; i<[Link]; i++) {
[Link](arr[i]);
}

27. What is a jQuery selector?


A jQuery selector is used to select HTML elements for manipulation.

28. How to select all elements using jQuery


$("*")

29. How to select multiple elements using jQuery?


$("p, div, span")

Common questions

Powered by AI

HTML has three main flavors: the standard HTML which is the basic text formatting language for creating web pages; XHTML, which is a stricter, XML-based version of HTML; and HTML5, the latest version that includes support for multimedia, graphics, and semantic elements .

CSS plays a critical role in responsive design by allowing developers to create flexible layouts that adjust to various screen sizes and devices. Media queries are pivotal as they apply styles conditionally based on device characteristics like width, enabling designs to maintain usability and aesthetics across diverse environments .

HTML5 semantic elements like <article>, <section>, <header>, and <footer> improve web accessibility by providing meaningful page structure, helping screen readers interpret content better. They enhance SEO by making it easier for search engines to parse the page layout, improving content discoverability and ranking .

The DOM is crucial because it provides a standard model for representing and interacting with objects in HTML and XML documents, allowing scripts to update content, structure, and style dynamically. This interactivity enhances functionality by making web pages dynamically responsive to user actions, improving user experience .

HTML5 provides advantages such as built-in support for multimedia elements like video and audio, eliminating the need for third-party plugins, and it offers new semantic elements that improve web accessibility and search engine optimization. It also enhances graphics capabilities with the canvas element and JavaScript APIs for complex web applications .

CSS can significantly impact webpage performance and loading times. Well-structured CSS improves page speed by enabling efficient rendering and reducing the need for multiple HTTP requests. To optimize performance, use minimized and compressed CSS, reduce unnecessary selectors, and utilize media queries to load styles conditionally .

Scripting languages like JavaScript enhance HTML by introducing interactivity and dynamic behaviors to static webpages. While HTML structures content, scripting allows for user interaction, changes content dynamically, and responds to events, offering a more engaging user experience .

Inline styles apply CSS directly to elements using the style attribute, suitable for quick style changes. Internal styles, placed within the <style> tag in the HTML document, are used for single-page style consistency. External stylesheets, linked via the <link> tag, separate style from content and allow for site-wide style changes and maintainability .

JavaScript events like 'onclick' and 'onmouseover' trigger interactive behaviors in response to user actions, such as clicking or hovering over an element. They enable real-time user engagement through dynamic content updates, animations, or input validation, enhancing interactivity and the overall user experience on web pages .

XHTML differs from HTML by enforcing stricter syntax rules derived from XML, ensuring documents are well-formed, which enhances reliability and ensures better compatibility across different devices and browsers. Its benefits include consistency and potential for richer data interchange .

You might also like