TECNOLOGÍAS WEB 2_HTML
Introduction to Web Technologies and HTML
Understanding HTML
- HTML stands for Hypertext Markup Language, which is a standard metalanguage used to create the structure of web pages.
- It consists of specific tags like
<heading>and<paragraph>, which guide the browser on how to render the webpage content.
Basic Structure of an HTML Page
- The initial skeleton of a simple webpage includes essential tags that define its structure, starting with
<!DOCTYPE html>.
- The opening and closing tags are crucial; each tag has a corresponding closing tag marked by a forward slash (e.g.,
</html>).
Metadata in HTML
- The
<head>section contains metadata such as the page title (<title>), which does not display on the page but appears in browser tabs.
- Metadata can also indicate language settings or link to stylesheets, enhancing the webpage's functionality without being visible in the main content.
Rendering Content in Browsers
Visual Representation
- A visual comparison between code in an editor (left side) and its rendered output in a browser (right side) illustrates how browsers interpret HTML.
- The title appears in the tab but not within the main content area, highlighting common misconceptions about where metadata is displayed.
HTML Tags: Text and Lists
Key Text Tags
- Important text-related tags include
<br>for line breaks, which self-closes without needing a separate closing tag.
- Tags like
<strong>and<em>emphasize text;<strong>renders as bold while<em>typically appears italicized.
List Structures
- Ordered lists use
<ol>for numbered items, while unordered lists utilize<ul>, with list items defined by<li>.
- Examples demonstrate how these lists render differently: ordered lists show numbers while unordered lists display bullet points.
Block Elements vs. Inline Elements
Understanding Block Elements
- Block elements occupy their own space on a webpage, contrasting with inline elements like those discussed earlier (
<strong>,<em>) that flow within text lines.
HTML Elements and Structure
Understanding Block Elements in HTML
- The most common block elements in HTML are headers, which come in six levels (h1 to h6). It's crucial for a second-level header (h2) to follow a first-level header (h1) to maintain proper page structure.
- Headers are rendered by importance, with h1 typically being the largest. Paragraphs, denoted by the
<p>tag, create blocks of text that automatically include line breaks.
- Generic blocks can be created using the
<div>tag. This allows for grouping various elements together on a webpage, enhancing layout flexibility.
Adding Links and Images
- Links are created using the
<a>tag with anhrefattribute specifying the destination URL. The clickable text appears between the opening and closing tags.
- For images, the
<img>tag is used along with thesrcattribute to define where the image is located. Additional attributes likealt, width, and height can also be specified.
Incorporating Iframes
- The
<iframe>element allows embedding external content such as videos into a webpage. It requires attributes for size and source location similar to images.
- Other parameters can control iframe behavior, such as removing borders or enabling fullscreen mode. Visual examples help illustrate how iframes function within web pages.
Creating Page Hierarchies
- A website's structure can be organized hierarchically through internal links. For instance, clicking on a contact link could lead to another page like
contact.html.
- Resources like HTML5UP provide templates that simplify web design by offering pre-made layouts that users can modify according to their needs.
Responsive Design Considerations
- Many templates from resources like HTML5UP feature responsive designs that adapt across devices—tablets and mobile phones—ensuring usability regardless of screen size.
HTML5 Semantic Elements and Their Importance
Evolution of HTML Standards
- The H2B5 standard has evolved, with version 5 introducing various semantic tags that provide more descriptive information about the content being defined.
- These predefined tags help create a structured and semantically ordered layout for web pages, enhancing clarity and organization.
Distinction Between Header and Head
- It's crucial to differentiate between the
<header>tag (which contains metadata) and the<head>section of an HTML document.
- The
<header>can include elements like logos and page titles, while the<nav>tag is used to create navigation menus on websites.
Structuring Content with Sections and Articles
- Sections in HTML are typically more static, providing descriptive content, whereas articles represent dynamic content such as news or blog posts.
- Multiple instances of these tags can be utilized within a single page to organize different types of content effectively.
Use of Additional Block Elements
- Other block elements can describe additional features like sidebars commonly found in blogs, enhancing overall site structure.
- The use of specific tags like
<footer>instead of generic<div>elements improves semantic clarity in web design.
Impact on Search Engine Optimization (SEO)
- Properly structured HTML not only aids user experience but also influences how search engines index pages, potentially improving visibility in search results.