Week 7 - Mark up Languages Flashcards
What is a markup language?
A system for annotating text with computer-parseable information to define:
How text should be interpreted: Tags like <h1> indicate the text is a heading.
How it should be presented: <h1> makes the text appear larger and bold.
Relationships between text: A hyperlink tag <a> connects one text to a URL.</a>
GET VS POST
GET - SAFE AND IDEMPOTENT
GET - FASTER
POST IS BETTER FOR LARGE DATA AND SECURITY
- DOESNT EXPOSE ALL SUMBITTED INFORMATION AS PART OF URL IN QUERY STRING
What is the rule about hierarchy in markup languages?
Markup annotations must not overlap; tags should be nested properly.
Example (Proper Nesting):
<b><i>This text is bold and italic</i></b>
Example (Improper Nesting):
<b>This text is <i>bold and italic</b></i></b>
What is HTML, and what is it used for?
HTML (Hypertext Markup Language) structures and presents content on web pages USING PREDIFINED TAGS ( IMPORTANT)
Example:
<h1>Welcome to My Website</h1>
<p>This is a paragraph of text.</p>
<a>Visit Example</a>
What is XML, and how does it differ from HTML?
XML (Extensible Markup Language) is used to store, organize, and transfer data. Unlike HTML, XML focuses on data structure, not presentation.
Example:
<bookstore>
<book>
<title>Introduction to Programming</title>
<author>John Doe</author>
<price>29.99</price>
</book>
</bookstore>
Relation to XML’s Focus on Data Structure:
In this example, <bookstore>, <book>, <title>, and <author> are custom tags that describe the structure of the data (e.g., a bookstore catalog).</author></title></book></bookstore>
XML DOES NNOT SPECIFY HOW the DATA should be DISPLAYED (e.g., font size, color), leaving that responsibility to the application using the XML file.
Contrast with HTML:
HTML uses predefined tags like <h1> or <p> to control how content looks on a web page, focusing on presentation rather than data organization.
What is hypertext, and how does it differ from linear text?
Hypertext is non-linear text that includes links to other text, allowing users to navigate across documents through multiple paths.
Example (HTML):
<a>Go to Chapter 2</a>
Clicking this link takes the user directly to Chapter 2, unlike linear text which must be read sequentially.
What is HTML, and what is its purpose?
HTML (Hypertext Markup Language) is the language used to structure and present content on web pages.
It describes the structure of a web page: Elements like headings, paragraphs, and links.
It specifies how content is presented: By defining visual elements like bold text or lists.
Example:
<h1>Welcome</h1>
<p>This is my website.</p>
<a>Visit Here</a>
What is the basic structure of an HTML document?
An HTML document consists of:
Root element <html>: The parent tag.
Head <head>: Contains metadata and the document title.
Body <body>: Contains the main content visible to users.
Example:
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
full example of html doc if you wanna see
<!DOCTYPE html>
<html>
<head>
<meta></meta>
<meta></meta>
<meta></meta>
<meta></meta>
<title>Example HTML Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is an example of a simple HTML document.</p>
<h2>Features of This Page</h2>
<ul>
<li>A structured heading system</li>
<li>Meta tags for better SEO and accessibility</li>
<li>An example of an image and link</li>
</ul>
<img></img>
<p>Visit the <a>example website</a> for more information.</p>
</body>
</html>
Head (<head>): Contains metadata like the title, description, author, and technical settings.
Note: The <title> element is not displayed within the
page content but appears in the browser tab and
search engine results.</title>
Body (<body>): Contains all the visible content for the user, such as headings, paragraphs, images, and links.
What does the action attribute in an HTML form do?
The action attribute specifies the URL where the form data will be sent when submitted.
What happens when a form uses the GET method?
Data is appended to the URL as query parameters (e.g., /personalData?name=John) and sent to the server.
When should you use the GET method in forms?
when:
Data is non-sensitive (e.g., search terms, filters).
URLs need to be shareable or bookmarkable.
Transparency in the request is useful.
What are the limitations of the GET method?
Data is visible in the URL (not secure for sensitive data).
Limited to short data due to URL length restrictions (usually ~2000 characters).
What happens when a form uses the POST method?
Data is sent in the HTTP request body (not appended to the URL) and is not visible in the browser’s address bar.
hides it from URL but if you want to make it MORE SECURE:
if you want to make it extremely secure combine with HTTPS
When should you use the POST method in forms?
: Use POST when:
Submitting sensitive data (e.g., passwords, personal details).
Sending large amounts of data (e.g., file uploads).
Modifying server-side resources (e.g., creating or updating data).