Learn HTML And Know That You Don’t Know
Table of Contents
What is HTML?
- HTML stands for “Hypertext Markup Language.”
- It is the language used to create web pages and give them structure and format.
- HTML uses tags to mark different elements on a web page.
- Tags are like order or instructions that tell the web browser how to display the content.
- HTML Tags always comes in pairs: one is called opening and another is called Closing tag. Tags always enclosed by angel bracket (<>).
- Web browsers read the HTML code and display the web page accordingly.
Basic HTML Structure
- Every HTML document starts with the <html> tag and ends with the </html> tag.
- The main content of a web page is placed between the <body> and </body> tags.
- Headings are used to create different levels of headings, such as <h1>, <h2>, <h3>, and so on.
- Paragraphs are created using the <p> tag.
- Links are created using the <a> tag and the href attribute, which specifies the URL of the linked page.
Working with Images
- You can add images to your web page with the help of this <img> tag.
- The src attribute is used to specify the source or location of the image file.
- Alt attribute provides alternative text for the image, which is displayed if the image cannot be loaded.
- You can resize your Images the width and height attributes.
Creating Lists
- Unordered lists are created using the <ul> tag and list items are created using the <li> tag.
- Ordered lists are created using the <ol> tag, and list items are also created using the <li> tag.
- Nested lists can be created by placing one list inside another.
Formatting Text
- Text can be formatted using different tags, such as <strong> for bold, <em> for italic, and <u> for underline.
- Headings, paragraphs, and other text can be aligned using CSS styles.
Adding Basic Styling
- CSS (Cascading Style Sheets) is used to add styles and colors to HTML elements.
- CSS can be added to an HTML page using the <style> tag or by linking an external CSS file.
- Colors can be specified using different color names or hexadecimal codes.
Q.1 What does HTML stand for?
- HTML stands for Hypertext Markup Language.
Q 2.What is the purpose of HTML in web development?
- HTML is used to create web pages and give them structure and format.
Q 3.What are HTML tags? Give examples of three commonly used HTML tags.
- HTML tags are instructions that tell the web browser how to display content.
- Examples of commonly used HTML tags are:
- <h1> for heading
- <p> for paragraph
- <a> for hyperlink
- Examples of commonly used HTML tags are:
Q.4 How do you create a hyperlink in HTML? Explain with an example.
- Hyperlinks are created using the tag in HTML.
- Example: <a href=”https://www.example.com”>Click here</a>
Q 5.How do you add an image to an HTML page? Explain with the required HTML tags and attributes.
- Images are added using the tag and the src attribute to specify the image source.
- Example: <img src=”image.jpg” alt=”Description of the image”>
Q 6.What is the purpose of the alt attribute in an <img> tag?
- The alt attribute provides alternative text for the image, which is displayed if the image cannot be loaded.
Q 7.How do you create a numbered list in HTML? Provide an example.
- Numbered lists are created using the
- tag, and each list item is created using the
- tag.
- Example:
- code
- Example:
- tag.
<ol> <li>First item</li>
<li>Second item</li>
<li>Third item</li> </ol>
Q 8.Explain what is an opening tag and a closing tag in HTML?
- An opening tag is used to start an HTML element, while a closing tag is used to end it.
Q 9.How do you format text as bold in HTML? Provide an example.
- Text can be formatted as bold using the tag.
- Example: <strong>This text is bold</strong>
Q 10.What is the role of CSS in HTML? Briefly explain its purpose and how it is used.
- CSS (Cascading Style Sheets) is used to add styles and colors to HTML elements.
- It is used to control the appearance of web pages by specifying fonts, colors, layouts, and more.