









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Hello
). Some are self- closing (e.g., tags are used to define blocks of text. Text Formatting: Elements like , , , allow for semantic and presentational formatting of text. Styles: Inline styles (using the style attribute) can be applied directly to elements for visual changes. Editors: HTML can be written using simple text editors or more advanced IDEs. © Detailed Notes 1, Whal is HTML? Definition: HTML stands for HyperText Markup Language. It's the standard language used to create web pages and web applications. Markup Language: It uses a series of fags to describe the structure and content of a web page. It's not a programming language; it doesn't have logic or computations. Hypertext: Refers to the way web pages link together, allowing users to navigate between documents. 2. Basic HTML Document Structure Every HTML document follows a fundamental structure: My First Heading
My first paragraph.
: Definition: This declaration defines the document type and version of HTML. It's not an HTML tag itself but an instruction to the browser about what type of document to expect. Explanation: For modern HTMLS, it's always . It ensures browsers render the page in "standards mode." element: Definition: The root element of an HTML page. All other elements are nested inside it. Explanation: It signifies the beginning and end of the HTML document. element: Definition: Contains meta-information about the HTML page, not visible directly on the web page. Explanation: Information here includes the page title, character set, links to stylesheets, scripts, and other metadata for search engines or browser display configuration.
width and height attributes: Used with
alt attribute: Used with This is a blue paragraph.
lang attribute: Declares the language of the document. Important for accessibility and search engines. Example: title attribute: Provides extra information about an element, which is often displayed as a tooltip when the mouse hovers over the element. Example:This is a paragraph.
5. HTML Headings () Definition: The
element defines a paragraph of text. Behavior: Browsers automatically add some whitespace (margin) before and after a paragraph.
This is the first paragraph.
This is the second paragraph.
Line Breaks (This is a paragraph.
This is a new line within the same paragraph.
This is small text.
This is my very first web page created using basic HTML. I'm learning h
HTML elements Like headings and paragraphs help organize information cl Reasoning: : Essential doctype for HTML5. : Root element, specifying English language.
: Contains metadata.tags: Define the two separate paragraphs of text. Example 2: Using Attributes and Basic Styling Problem statement: Create an HTML snippet that displavs a bold, red paragraph of text, followed by a link to Google with a tooltip, and an image from pic. jpg that is 300px wide and 200px tall, with "A beautiful landscape" as alternative text. Solution:
Reasoning:
...
:The tag holds the paragraph. The style attribute sets the text color to red. The tag makes the text bold. ...:The tagcreatesa hyperlink. href : Specifies the target URL. target="_blank" : Opens the link in a new tab. title : Provides a tooltip when hovering over the link. This is a paragraph. Hello World! This is a paragraph. This is a paragraph. This is a paragraph.
: Inserts two line breaks for visual separation.
:The tag embeds an image. src : Specifies the image file path. alt : Provides alternative text for accessibility. width and height : Set the image dimensions. Example 3: Text Formatting and Semantic Elements Problem statement: Display a sentence where "urgent" is strongly important, "important" is simply bold, "stress" is emphasized, "slight" is italic, a numerical value is superscript, and a chemical formula is subscript. Solution: .,
b)
c)
d)
(though cancontain
width as an attribute expects an integer ( width="100" would mean 100 pixels). To specify a percentage, use CSS viathe style attribute. isthe mostimportant, isthe least.
,
This is incorrect.
S/SEPGNG? Cll Saaremaa retratererrne TT era ener pr eee tame mere rreTettrerrere ree CG innermost tag first. Using Headings for Styling Only: Don't use because vou want big text. If it's not a heading, use a paragraph ( ) with CSS styling ( font-size , font-weight ) instead. This harms SEO and accessibility. Ignoring the alt attribute for : This is crucial for accessibility (screen readers) and when images fail to load. Provide descriptive alt text. Confusing / with / : While they might look similar, remember the semantic difference. Use semantic tags when importance/emphasis is intended. Using spaces in file names: When linking to local files (images, other HTML pages). spaces in file names can cause issues. Use hyphens ( - ) or underscores ( _ ) instead (e.g., my- image. jpg ). Saving with wrong extension: Always save your HTML files with -html or .htm extension, not Exe, Not checking your code in a browser: Always open your .html file in a browser to see how it renders. What you typed in your editor isn't what people will see on the web. Over-reliance on inline styles: While the style attribute is handy for auick changes, for larger projects, it's better to use internal (