Web Design

Cover

2.4. Taules i formularis.pdf

1. Introducción y estructura básica de las tablas HTML

Este resumen cubre la estructura fundamental de las tablas HTML, la adición de elementos semánticos clave y las propiedades CSS esenciales para su estilismo, como el manejo de anchos, alineaciones, bordes y fondos.

1.1. La tabla más básica

Las tablas HTML sirven para organizar datos en formato tabular. La estructura mínima requiere tres etiquetas principales 3:

  • <table> </table>: Delimita el contenido que será organizado de forma tabular.

  • <tr> </tr> (Table Row): Define una fila dentro de la tabla, organizando el contenido horizontalmente.

  • <td> </td> (Table Data): Define una celda de datos individual dentro de una fila.

La anidación básica es la siguiente, donde el número de <td> debe ser consistente en cada <tr> para formar columnas 4:

<table> <tr> <td>content</td> <td>content</td> <td>content</td> </tr> <tr> <td>content</td> <td>content</td> <td>content</td> </tr> </table>

1.2. Afegir altres funcions semàntiques

Para mejorar la semántica y la legibilidad (especialmente para lectores de pantalla), se introducen el título de la tabla y los encabezados de columna 5:

  • <caption> </caption>: Proporciona un título a los datos de la tabla. Por defecto, los navegadores lo centran y le dan el ancho total de la tabla.

  • <th> </th> (Table Header): Define el contenido como un encabezado de columna, dándole una semántica específica.

1.3. Seguir estructurant la taula

Una estructura más completa incluye secciones para el encabezado, el cuerpo y el pie de la tabla, junto con atributos para manejar celdas combinadas y metadatos descriptivos:

  • <thead>, <tbody>, <tfoot>: Definen, respectivamente, la cabecera, el cuerpo y el pie de la tabla. Esto ayuda a la estructuración interna y a la visualización en dispositivos diversos.

  • colspan y rowspan: Atributos aplicados a <th> o <td> que permiten que una celda ocupe más de una columna (colspan) o más de una fila (rowspan). Por ejemplo, <td colspan="4"> hará que la celda ocupe cuatro columnas 7.

  • summary: Un atributo opcional en la etiqueta <table> que proporciona un resumen del contenido, utilizado por lectores de pantalla 6.

  • scope: Atributo utilizado únicamente dentro de la etiqueta <th>. Indica si el encabezado aplica a una columna (scope="col") o a una fila (scope="row").

Tip: Aunque el atributo summary en <table> era relevante, la práctica moderna prioriza la descripción semántica del contenido y, si es necesario, una explicación en texto normal fuera de la tabla.

1.4. Millorar l’estil de la taula amb CSS

El estilo es fundamental para el aspecto visual de las tablas. Se utilizan diversas propiedades CSS para controlar el layout y la apariencia 8:

1.4.1. Ample i alineació

Por defecto, las tablas usan width: auto, lo que puede resultar en un diseño desordenado. Es común forzar un ancho fijo o porcentual:

  • Ancho de tabla: Se define con la propiedad width en el selector table.

  • Alineación del texto: Se usa text-align en th y td (ej. left, center, right) 10.

  • Alineación vertical: Se controla con vertical-align en th y td (ej. top, middle, bottom) 11.

Example: Para alinear el texto en la parte superior de la celda:

th, td { vertical-align: top; }

1.4.2. Gestió de voreres (Borders)

Aplicar bordes requiere gestionar cómo interactúan entre sí los bordes de la tabla y los de las celdas individuales.

Existen dos métodos principales para controlar el espaciado y la superposición de bordes:

  1. border-spacing: Define el espacio entre los bordes de celdas adyacentes. Si se establece a 0, los bordes se tocan. Si se aplica un borde de 1 píxel con border-spacing: 0, el borde total percibido será de 2 píxeles (1px del borde de la celda A y 1px del borde de la celda B).

table { border: 1px solid #000; border-spacing: 0; /* Hace que los bordes se toquen */ }

  1. border-collapse: Hace que las celdas compartan bordes en lugar de tener bordes dobles.

    • border-collapse: collapse; es la solución preferida si se desea un borde de 1 píxel de ancho, ya que fusiona los bordes adyacentes.

    • Cuando se usa collapse, el fondo de la tabla no será visible entre las celdas, ya que los bordes se superponen.

Cover

Chapter 2(1)_ Using HTML.pptx

📚 Chapter 2(1)_ Using HTML.pptx

Brief overview

This document introduces HyperText Markup Language (HTML) and its fundamental role in building web pages. Understanding these core concepts is essential for creating and structuring content for the internet.

Key points

  • Introduction to HTML, its purpose, and basic page structure.
  • Formatting text with headings, paragraphs, and visual styles.
  • Incorporating images, links, and organizing content with tables and lists.
  • Understanding and creating HTML forms with various input types.

1. Introduction to HTML

1.1 What is HTML?

HTML stands for Hyper Text Markup Language. It is the standard language used to create web pages.

HTML defines the structure of a web page using elements. These elements label content, telling the browser how to display it.

For example, an element can indicate "this is a heading" or "this is a paragraph."

1.1.1 Basic HTML structure

A basic HTML document has a specific structure. It begins with a <!DOCTYPE html> declaration, identifying the document as HTML5.

The <html> element is the root of the entire page. Inside it, the <head> section contains meta-information, such as the page title.

The <title> element specifies text shown in the browser tab or title bar. The <body><body> element contains all visible content, including headings, paragraphs, and images.

Key structure elements:

ElementPurpose
<!DOCTYPE html>Declares the document type as HTML5.
<html>The root element of an HTML page.
<head>Contains meta-information about the page.
<title>Sets the title shown in the browser tab.
<body><body>Contains all the visible content of the page.

1.2 Loading static web pages

When you enter a website's URL, your browser requests files from the web server. This includes HTML, CSS, and JavaScript files.

The server returns these files. The browser then interprets the HTML to display the static content.

1.3 Formatting text

HTML provides tags to format text and structure content.

1.3.1 Headings

Headings are used to organize content hierarchically. HTML offers six levels of headings, from <h1> (largest) to <h6> (smallest).

Heading levels:

TagSize
<h1>Largest
<h2>
<h3>
<h4>
<h5>
<h6>Smallest

1.3.2 Paragraphs

The <p> tag defines a paragraph of text. It creates a block of text separated from other content.

1.3.3 Line breaks and horizontal rules

A <br /> tag inserts a line break, forcing content onto the next line without creating a new paragraph. The <hr /> tag creates a horizontal rule, a thematic break between sections of content.

1.3.4 Alignment

Text alignment can be controlled using the align attribute within tags like <h1> or <p>. Common values include center and right.

Text alignment options:

Attribute ValueEffect
centerCenters text.
rightAligns text to the right.
left (default)Aligns text to the left.

1.4 Page formatting and divisions

HTML allows for page-level formatting, such as background color. The bgcolor attribute on the <body><body> tag sets the page's background color.

1.4.1 Creating divisions

The <div> element is a generic container. It groups other elements to apply styles or structure.

You can use inline styles directly within a <div> tag to control font size, color, and other properties for the enclosed content.

📝 Example: A <div> with style="font-size:24px; color:red;" will make its contained text red and 24 pixels in size.

1.5 Comments

Comments in HTML are not displayed by the browser. They are used for notes within the code.

Comments start with <!-- and end with -->.

🔑 Important: Use comments to explain code sections or to temporarily disable code snippets without deleting them.

🔑 Important: Comments help you or others understand the code later. They are also useful for experimenting with new code.

1.6 HTML tags and elements

HTML uses tags to define elements. Tags are enclosed in angle brackets, like <p>.

Elements consist of a start tag, content, and an end tag (e.g., <p>This is a paragraph.</p>). Some elements, like <br />, are self-closing.

1.7 Links

Links, created with the <a> tag, allow navigation between pages.

Link types:

Cover

Chapter 2(2)_Intro_to_CSS_Text.pptx

📚 Chapter 2(2)_Intro_to_CSS_Text.pptx

Brief overview

This document introduces Cascading Style Sheets (CSS) and its fundamental principles for web styling. It covers how to apply styles using different methods, CSS syntax, and essential properties for text, color, and backgrounds. Understanding these concepts is crucial for creating visually appealing and well-structured web pages.

Key points

  • Overview of CSS application methods: inline, internal, and external stylesheets.
  • Understanding CSS syntax: selectors, properties, and values.
  • Styling text with font properties and defining colors.
  • Applying background colors and images to elements.
  • Exploring the CSS cascade and element spacing with margins and padding.

1. Introduction to CSS and its application methods

1.1 What is CSS?

  • CSS stands for Cascading Style Sheets.
  • It controls how web page content is presented.
  • CSS manages visual aspects like colors, margins, positioning, and sizes.

📝 Example: A CSS rule might set all headings to be blue with a 14-pixel font size and a 10-pixel margin.

1.2 Methods for applying CSS

There are three primary ways to apply CSS to an HTML document.

  • Inline styles: Applied directly to individual HTML elements.
  • Internal stylesheets: Defined within a <style> tag in the HTML <head>.
  • External stylesheets: Stored in separate .css files, linked to the HTML.

🔑 Important: External stylesheets offer the best separation of content and presentation. They also enable site-wide styling changes with one edit.

1.2.1 Inline styles

  • CSS code is added via the style attribute on an HTML element.
  • Styles only affect the specific element where they are applied.
  • This method is generally discouraged for maintainability.

📝 Example: <p style="color: red;">This text will be red.</p>

1.2.2 Internal stylesheets

  • CSS rules are placed inside <style> tags within the HTML document's <head>.
  • Styles affect all matching elements on that specific page.
  • This method improves content-presentation separation over inline styles.

📝 Example:

<head>
  <style>
    h2 {
      color: red;
    }
  </style>
</head>

1.2.3 External stylesheets

  • CSS rules are written in a separate .css file.
  • The HTML document links to this file using a <link> tag in the <head>.
  • Multiple HTML pages can link to the same external stylesheet.

📝 Example:

<!-- In HTML file -->
<head>
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>

<!-- In style.css file -->
h2 {
  color: red;
}

1.3 The "cascade" and style priority

  • Browsers apply CSS from inline, internal, and external sources.
  • Conflicts arise when different sources style the same element.
  • The cascade determines which style rule wins in a conflict.

🔑 Important: The order of priority is: Inline > Internal > External > Browser Default.

1.4 CSS syntax and selectors

  • A CSS rule consists of a selector and a declaration block.
  • The declaration block contains one or more `property: value pairs.
  • Each declaration must end with a semicolon.

📝 Example: p { color: blue; font-size: 16px; }

1.4.1 Types of selectors

Selectors target specific HTML elements to apply styles.

Selector TypeSyntaxDescription
Type SelectortagnameSelects all elements of a given HTML tag type.
Class Selector.classnameSelects elements with a specific class attribute.
ID Selector#idnameSelects a single element with a specific id attribute.
Pseudo-class:hover, :focusSelects elements based on their state.
Attribute Selector[attr='value']Selects elements with a specific attribute and value.

🔑 Important: ID selectors are for unique elements; class selectors can style multiple elements.

1.4.2 Selector combinations

  • Selectors can be combined to target elements more precisely.
  • A space between selectors targets a descendant element.
  • The > symbol targets a direct child element.

📝 Example: div p targets all <p> elements inside a <div>. div > p targets only `

Cover

Chapter2_Part2_The Internet Connecting Communicating Online (1).pdf

Table of contents

  1. CHAPTER 2
  2. How To: Connect to the Internet
  3. Cellular Networks
  4. Using Wi-Fi Hot Spots
  5. Explore Websites, Web Apps, and E- Commerce

1. CHAPTER 2

1.1 Web design basics

Web design involves creating websites that are accessible and visually appealing across different devices. Key technologies like HTML and CSS are used to structure and style content, while browsers interpret these to display webpages to users.

  • Responsive Web Design (RWD): Adapts website layouts to various screen sizes, ensuring usability on desktops, tablets, and smartphones.
  • HTML (HyperText Markup Language): A fundamental technology for structuring webpage content, defining elements like headings, paragraphs, images, and links.
  • CSS (Cascading Style Sheets): Controls the visual design and appearance of webpage content, dictating colors, fonts, and layout 2.
  • Browser: An application used to access and display web content, such as Chrome, Safari, Firefox, and Edge.
  • Home page/Start page: The first page displayed when a browser is opened 3.
  • Cache: Browsers store temporary copies of viewed pages to speed up loading times on subsequent visits.
  • Cookies: Small text files websites use to store user information and preferences.
  • Breadcrumbs: A navigation aid showing a user's location within a website's hierarchy, typically as a path like Home > Category > Subcategory 5.

1.2 Browser descriptions

Different browsers offer unique features and are preinstalled or available for download on various operating systems. Understanding these differences can help users choose the browser that best suits their needs for performance, privacy, and functionality.

BrowserKey Features
Apple SafariPreinstalled on Apple devices, default for macOS, fast performance, built-in social network sharing, parental controls, ease of use
Google ChromeFree, available for Windows, macOS, Linux; requires download and installation; independent tabbed browsing
Microsoft EdgeIncluded with Windows, default for most devices, not compatible with prior Windows versions; integrates with Cortana and OneDrive, offers annotation and reading
Mozilla FirefoxFree, available for Windows, macOS, Linux; requires download and installation; known for extensive plug-ins, enhanced privacy and security, spelling checker, tabbed browsing, password manager 4

📝 Mozilla Firefox is a free browser available for Windows, macOS, and Linux, known for its extensive plug-ins, enhanced privacy and security, and tabbed browsing 4.

1.3 Web addresses and URLs

Every webpage has a unique web address, known as a URL (Uniform Resource Locator), which specifies its location and can reveal information about its origin and sponsor. While some parts of a URL can often be omitted, understanding its structure is crucial for accurate navigation.

  • URL (Uniform Resource Locator): The unique web address that identifies a webpage's location on the Internet.
  • HTTP (Hypertext Transfer Protocol): The protocol used by URLs starting with "http://" to retrieve web pages.
  • URL interpretation: Reveals information about the webpage's sponsor, origin, and location 8.
  • Omission of "http://" or "www": Many browsers and websites allow users to omit these parts of a web address (e.g., "nps.gov" instead of "http://www.nps.gov").
  • Host name requirement: If the host name is not "www," it must be included in the web address.
  • Browser suggestions: Browsers may suggest similar or related websites when typing or entering an incorrect URL 9.

1.4 Internet protocols

Computers and devices communicate over networks using protocols, which are sets of common rules for exchanging information. The Internet uses an addressing system, similar to the postal service, to direct data, with IP addresses uniquely identifying each device.

  • Protocols: Common rules that computers and devices use to communicate and exchange information over a network.
  • Internet addressing system: Directs data to specific destinations, analogous to the postal service.
  • IP address: A unique numerical address (e.g., 69.32.132.255) that identifies each computer on the Internet, corresponding to a server address in a URL.
  • IP addressing schemes: The Internet uses IPv4 and IPv6; IPv6 was developed to expand the number of available IP addresses due to IPv4's decreasing availability 11.

1.5 Domain names and URLs

Domain names were developed to make IP addresses more memorable for users. A domain name, along with a pathname, helps identify specific files and folders on a web server, with common file extensions for webpages being.html or.htm.

  • Domain names: Created to make IP addresses easier for people to remember and identify specific websites.
  • URL components: A URL i
Cover

Chapter 3 (1).pptx

Table of contents

  1. Creating a menu with HTML and CSS
  2. Embedding images
  3. Embedding Videos (1 of 2)
  4. Building tables
  5. Styling tables
  6. Creating HTML forms

1. Creating a menu with HTML and CSS

1.1 Website navigation and user experience

A website menu is crucial for visitors to navigate a site, directly influencing the overall user experience. This experience encompasses the site's look, feel, color scheme, navigation, fonts, and the information presented.

  • User experience: The overall impression or emotion a visitor has when interacting with a website.
  • Navigation influences: Key aspects include the site's structure, placement of menu items, and the clarity of menu text.

1.2 Designing a user-friendly menu

Effective menu design follows several guidelines to ensure ease of use and accessibility.

  • Three-click rule: Users should be able to reach any content on the site within three clicks.
  • Consistency: Navigation structure and placement should remain consistent across all pages, with the homepage potentially being an exception.
  • Menu item organization: Links can point directly to pages or to sub-menus. Avoid overwhelming users with too many options at once.
  • Descriptive text: Menu item labels should be simple and self-explanatory, such as "Home," "Products," or "About Us."
  • Search functionality: A search feature, located on or near the menu, is beneficial for complex or extensive websites.

1.3 HTML5 structural elements

HTML5 introduced semantic tags to define common website structures, improving organization and accessibility.

  • <header>: Typically contains introductory content or navigational links for a page or section.
  • <nav>: Encloses the main navigation links of a website.
  • <section>: Represents a thematic grouping of content, usually with a heading.
  • <footer>: Contains information about the author, copyright data, or related links at the bottom of a page.

1.4 Constructing a menu with an unordered list

An unordered list (<ul>) is a common and effective way to structure menu items in HTML.

  • HTML structure: Menu items are placed within <li> (list item) tags inside the <nav> element.
  • Links: Each <li> typically contains an <a> (anchor) tag, linking to another page within the site.

1.5 Styling an unordered list menu

CSS is used to transform the default appearance of an unordered list into a functional and visually appealing navigation menu.

  • Body and HTML height: Setting height: 100%; for both html and bodybody ensures the page content can occupy the full viewport height.
  • Display block: HTML5 structural elements like <footer>, <header>, <section>, and <nav> are styled with display: block; to ensure they occupy their own space.
  • Floating elements: When an element is floated (e.g., to the left), other content can flow around it. This can affect the layout of block-level elements.
  • Navigation styling: Specific styles can be applied to the <nav> element, including width, float, margin-right, and margin-top.
  • List styling: To remove default bullet points and adjust spacing, properties like list-style-type: none;, padding-left: 0;, and text-indent: 5px; are used. background-color and line-height can also be adjusted.
  • Rounded corners: border-radius: 5px; can be applied to give the menu a softer appearance.

1.6 Styling menu items and links

Further styling enhances the interactivity and appearance of individual menu items and their links.

  • List item hover effect: The :hover pseudo-class in CSS allows for styling changes when a user's mouse pointer is over a list item (<li>). This can include changing the background color.
  • Link styling: Styles can be applied specifically to the anchor (<a>) tags within the list items to control text color, remove underlines, and adjust spacing. The selector nav ul li a targets these links precisely.

📝 When a user hovers their mouse over a menu item like "Products," its background color changes from a light gray to a light blue, providing visual feedback that the item is interactive.

2. Embedding images

2.1 The <img> tag

The `

Cover

Cours HTML - partie3.pdf

Table of contents

  1. Structuring Tags
  2. Realizing a Static Website with HTML5
  3. Integrating Forms into a Web Page
  4. Automatic Validation
  5. Buttons

1. Structuring Tags

1.1 The
tag

The <div> tag is a generic container that can hold any HTML element. It is a block-level element and has no inherent effect on content or layout unless styled with CSS. <div> is frequently used in conjunction with CSS for web page layout 1.

1.2 The tag

The `` tag, similar to <div>, produces no visual effect on its own. Its primary purpose is to apply CSS styles to specific parts of content, such as text, within an HTML document 1.

📝 The <nav> tag is used to define a block of navigation links, commonly employed with unordered (<ul>) or ordered (<ol>) lists. For example:

<nav>
  <ul>
    <li><a href="index.html">Accueil</a></li>
    <li><a href="inscription.html">Inscription</a></li>
    <li><a href="a_propos.html">À propos</a></li>
    <li><a href="contact.html">Contact</a></li>
  </ul>
</nav>

5

1.3 Semantic tags

Semantic HTML elements clearly describe their meaning to both the browser and developers. In HTML4, non-semantic elements like <div> and `` were used to structure pages, often identified by id or class attributes (e.g., <div id="nav">).

HTML5 introduced semantic elements that explicitly define different page sections 2 3.

Element TypeExamples
Non-semantic
,
Semantic, ,

1.4 Semantic tags in HTML5

HTML5 provides specific semantic tags to define the structure of a web page more clearly. These tags improve accessibility and make the code more understandable 3.

Semantic TagPurpose
Defines introductory content or a set of navigational links.
Specifies a block of navigation links.
Defines a section in a document.
Represents a self-contained piece of content.
Contains content that is tangentially related to the content around it.
Defines a footer for a document or section.
Represents a specific period in time or a date.

1.5 The and tags

The <header> tag typically contains introductory content such as a logo, menu, or social media links. The <footer> tag usually includes information like copyright notices, legal mentions, and links to less prominent pages 4.

1.6 The tag

The <nav> tag is used to define a block of navigation links, commonly employed with unordered (<ul>) or ordered (<ol>) lists. This section facilitates navigation between different pages within the same website 5.

1.7 The and
tags

The <main> tag designates the primary content of a web page, ensuring that search engines and assistive technologies can easily identify the most important information. The <section> tag is used to segment the content into distinct thematic parts, each typically having a heading 6.

📝 The <main> tag designates the primary content of a web page, ensuring that search engines and assistive technologies can easily identify the most important information. The <section> tag is used to segment the content into distinct thematic parts, each typically having a heading. For instance:

<main>
  <p>Texte d'introduction de mon contenu.</p>
  <section>
    <h2>Titre de ma section 1</h2>
    <p>Texte de ma section 1</p>
  </section>
  <section>
    <h2>Titre de ma section 2</h2>
    <p>Texte de ma section 2</p>
  </section>
</main>

6

1.8 The tag

The <article> tag is suitable for self-contained content that could be independently distributed or reused, such as blog posts, news articles, product listings, or comments 7.

1.9 The tag

The `

Cover

G_12_Web_m1.pdf

Table of contents

  1. Fundamentals of website design
  2. Principles and standards of website design
  3. Unit summary
  4. Unit review questions
  5. Planning website design
  6. Unit summary
  7. Unit review questions
  8. Developing information architecture
  9. Creating sitemaps
  10. Creating wireframes
  11. User flow mapping between web wireframe screens
  12. Introduction to mockups and prototypes
  13. Unit summary
  14. Unit review questions
  15. Answer key: Self-check questions

1. Fundamentals of website design

1.1 Understanding UX/UI design 3

User experience (UX) design is the process of creating websites that offer meaningful and relevant experiences to users. It encompasses the entire journey of acquiring and integrating a product, including its branding, design, usability, and functionality.

UX is defined as a person's perceptions and responses resulting from the use or anticipated use of a product, system, or service. This involves considering both how the product behaves and feels, and the user's emotions, beliefs, and comfort 2.

When designing user experience for a website, consider these key elements:

  • Ease of Use: Ensuring the website is simple and intuitive to navigate.
  • User-Centered Approach: Focusing on the user’s needs and challenges throughout the design process.
  • Holistic Experience: Considering all aspects of the website, from initial design to final development 2.

User interface (UI) design focuses on the visual and interactive elements of a website. This includes everything a user sees and interacts with, such as buttons, colors, typography, and navigation menus 3.

As a user interface designer, consider these key design elements:

  • Visual Design: Creating a website that is aesthetically pleasing and visually appealing.
  • Interactive Design: Ensuring smooth navigation and engaging interactivity for the user.
  • Responsive Design: Adapting the website's appearance and functionality to various devices and screen sizes 3.
FeatureExamples
LayoutUse a grid-based layout for structure and consistency. Place a sticky navigation bar at the top for easy access.
TypographyChoose a clean and modern sans-serif font for readability. Use a clear typographic hierarchy such as large, bold headings and medium-sized subheadings.
Color SchemeUse a neutral color for the background (e.g., white or light gray). Implement an accent color (e.g., blue or green) for call-to-action buttons and important elements.
Visual HierarchyHighlight primary actions like “submit” or “sign up” with distinct buttons. Use larger images and bold text when necessary.
InteractivityInclude hover effects for buttons and images to provide feedback. Add a quick view feature for images or links when users hover over them.
ResponsivenessEnsure the design adapts seamlessly to different screen sizes, including desktops, tablets, and smartphones. Prioritize a mobile-friendly design, with collapsible menus.

1.2 Activity 1-1: Website UX/UI Scenario for Discussion

This activity involves forming groups to browse and discuss local websites, focusing on their UX and UI design. The discussion questions aim to evaluate user experience, identify frustrations, understand the impact of design on trust and engagement, and suggest improvements 4.

📝 For example, if you are designing a mobile app, the UX design determines how the app solves user problems and ensures a logical flow, while the UI design ensures the app's interface is attractive and easy to navigate 4.

1.3 Differences between UX and UI Design 5

While UX and UI design are closely related, they focus on different aspects of a website. UX design determines how an app or website solves user problems and ensures a logical flow, focusing on the user's journey, research, strategy, and problem-solving.

UI design, on the other hand, ensures the app's or website's interface is attractive and easy to navigate, focusing on visual details, design, aesthetics, and appearance 4.

UX DesignUI Design
User JourneyVisual Details
Research and StrategyDesign and Aesthetics
Problem-SolvingAppearance

A great website requires both UX and UI designs to be considered, as they are complementary 5.

1.4 Self-check 1-1

This self-check assesses understanding of User Experience (UX), User Interface (UI), and the differences between them 5.

1.5 Principles and Standards of Website Design

Website design is an evolving field that requires designers to adapt to technological advancements and user expectations, prioritizing both aesthetics and usability 6.

1.6 Principles of Website Design

Several key principles guide effective website design to create standardized and impactful sites 6.

| Principle | D

Cover

ICT 2 SUMMATIVE 1

Table of contents

  1. HTML Document Structure

  2. Editing/Creating Websites

1. HTML Document Structure

1.1 HTML document structure

HTML documents follow a rigid hierarchical tree structure that tells the browser how to read and render the page properly. This structure acts as a blueprint or skeleton, organizing the webpage into distinct container components 1.

  • <!DOCTYPE html>: This is the opening preamble that instructs the browser that the document is written in HTML, ensuring modern rendering.

  • <html>: This is the root element that wraps all content on the page.

  • <head>: This is the metadata container. It holds backend data not directly visible to users, such as character sets, page scaling instructions, and links to external styles and scripts.

  • <title>: This element specifies the tab name for the webpage.

  • <body><body>: This is the visible content container. It houses paragraphs, headers, structural layout dividers, images, and links displayed on the screen 1.

📝 The <html> tag wraps all content on the page, like this: <html><body><h1>My Page</h1></body></html> 1.

1.2 HTML elements and tags

An HTML element is a standalone component created by combining an opening tag, the inner content, and a closing tag. Tags are individual markers inside angle brackets, while elements are the entire package comprising the opening tag, content, and closing tag 1.

  • Void elements: These elements cannot contain nested content and do not use closing tags. Examples include <br> (line break) and <img> (image) 1.

1.3 HTML attributes

HTML attributes are special modifiers used inside the opening tag of an HTML element. They provide additional information, configuration, or behavioral adjustments to that element 1.

Attribute

Applies To

Description

id

All elements

Unique identifier for a single element across the page.

class

All elements

Groups multiple elements together for targeted CSS styling.

style

All elements

Embeds inline CSS to change the element's appearance.

title

All elements

Defines supplementary text shown as a tooltip when hovering over the element.

Attribute

Applies To

Description

href

Link tags (<a>)

Specifies the target URL for a link.

src

Image and script tags (<img>, <script>)

Defines the source path for images and scripts.

alt

Image tags (<img>)

Alternative text displayed if an image fails to load properly.

type

Input elements (<input>)

Sets the explicit data input mechanism for input elements.

Cover

ilovepdf_merged.pdf

1. Inleiding tot JavaScript en DOM-selectie

Dit onderdeel introduceert JavaScript als programmeertaal voor het web, de integratie ervan in HTML en de fundamentele methoden om elementen binnen het Document Object Model (DOM) te selecteren.

1.1 Wat is JavaScript?

JavaScript is een programmeertaal die wordt uitgevoerd door de webbrowser. Het wordt hoofdzakelijk gebruikt om dynamische webpagina's te creëren en interactie op de client-side mogelijk te maken 3.

1.2 JavaScript koppelen aan HTML

Om JavaScript in een HTML-pagina te gebruiken, wordt het <script>-element ingezet. Dit kan gebruikt worden om inline code te plaatsen of, vaker, om een extern JavaScript-bestand te linken met behulp van het src-attribuut.

Tip: Een gebruikelijk en aanbevolen patroon is om het <script>-element vlak voor de afsluitende </body>-tag te plaatsen 5.

De browser voert JavaScript uit op de locatie waar het in de HTML wordt gevonden 6.

Wanneer de browser een <script>-element tegenkomt, pauzeert deze het parseerproces van de HTML om het script te laden en vervolgens uit te voeren, waarna het parsen van de rest van het document wordt hervat 7.

1.3 Basisuitvoering en logging

Een directe manier om JavaScript-uitvoer te controleren tijdens de ontwikkeling is door gebruik te maken van de browserconsole. De functie hiervoor is console.log().

Example:

console.log('test')
let y = 1;
console.log(y);
let x = 1
console.log("y:", y)

8.

1.4 Het Document Object Model (DOM)

Het DOM is de structuur die representaties van HTML-elementen biedt, waardoor JavaScript deze kan selecteren, manipuleren en updaten 10 9.

1.5 Elementen selecteren in het DOM

Er zijn verschillende methoden beschikbaar om specifieke elementen of groepen elementen uit het DOM te selecteren op basis van hun unieke ID, klasse, tagnaam, of via CSS-selectors 11.

1.5.1 Selecteren op basis van ID

De methode document.getElementById() selecteert één enkel element op basis van zijn unieke ID.

Example: Voor de HTML:

<li id=“one” class=“hot”>fresh figs</li>

Gebruik JavaScript: document.getElementById('one'); 12.

1.5.2 Selecteren op basis van Klasse

De methode document.getElementsByClassName() zoekt en retourneert een verzameling van alle elementen die een specifieke CSS-klasse bevatten.

Example: Selecteert alle elementen met de klasse "hot": document.getElementsByClassName('hot'); 13.

1.5.3 Selecteren op basis van Tagnaam

De methode document.getElementsByTagName() retourneert een verzameling van alle elementen die overeenkomen met de gespecificeerde HTML-tagnaam.

Example: Selecteert alle <li> elementen: document.getElementsByTagName('li'); 14.

1.5.4 Modern selecteren met querySelector

De methode document.querySelector() selecteert het eerste element dat overeenkomt met de opgegeven CSS-selector.

Example: Selecteert het element met ID 'two': document.querySelector('#two'); 15.

1.5.5 Modern selecteren met querySelectorAll

De methode document.querySelectorAll() selecteert alle elementen die overeenkomen met de opgegeven CSS-selector en retourneert deze als een NodeList of HTMLCollection.

Example: Selecteert alle <li> elementen die tevens de klasse 'hot' hebben: document.querySelectorAll('li.hot'); 16.

1.6 HTMLCollections en NodeLists

Wanneer een DOM-query meerdere elementen teruggeeft (zoals bij het gebruik van getElementsByClassName, getElementsByTagName, of querySelectorAll), wordt het resultaat opgeslagen in een structuur die bekend staat als een NodeList of een HTMLCollection 17.

Deze verzamelingen gedragen zich als arrays: ze zijn genummerd en elementen kunnen via een index benaderd worden.

Example:

elements = document.getElementsByClassName('hot');
let firstItem = elements;

18.

1.6.1 Controleren op elementen en itereren

Het is belangrijk om te controleren of de verzameling überhaupt elementen bevat voordat er toegang wordt gezocht tot een index, om fouten te voorkomen.

Example: Controle of er minstens één element is:

if (elements.length >= 1) {
let firstItem = elements ;
}

19.

Om over alle items in de verzameling te itereren, kan een standaard for-loop worden gebruikt.

Example (Loop over items):

for (let i = 0; i < elements.length; i++)
{
console.log(elements[i]);
}
Cover

Lecture 8. CSS Layout.pdf

📚 Lecture 8. CSS Layout.pdf

Brief overview

This document details modern and traditional CSS layout techniques essential for web page structure. Understanding these methods is crucial for creating visually appealing and functional websites that adapt to various screen sizes.

Key points

  • Overview of older CSS layout methods including block, inline, inline-block, floats, and positioning.
  • Introduction to Flexbox for one-dimensional content arrangement and its core properties.
  • Explanation of CSS Grid for powerful two-dimensional layout design and content placement.
  • Exploration of responsive web design principles and adaptive layout strategies.
  • Practical application of layout techniques for different screen sizes and devices.

1. Older CSS layout methods

1.1 Basic display modes

CSS <span style="color: #ff9f29; font-weight: 700;">display</span> property controls how elements are shown. Elements are generally either <span style="color: #ff9f29; font-weight: 700;">block</span> or <span style="color: #ff9f29; font-weight: 700;">inline</span> by default.

  • Block-level elements:

    • Start on a new line.
    • Cannot share a line with other block elements.
    • Respect the CSS box model (margins, padding, borders, colors) 1.
  • Inline elements:

    • Do not start new lines.
    • Flow horizontally on the same line.
    • Content wraps to a new line if space is insufficient.
    • Ignore width, height, and top/bottom margins.

1.2 Inline-block display mode

The <span style="color: #ff9f29; font-weight: 700;">inline-block</span> display mode combines features of both block and inline elements.

  • Inline-block elements:
    • Sit on the same line, wrapping as needed.
    • Respect box model properties like width and height.
    • Allow control over margins.

The display property lets you change an element's mode to <span style="color: #ff9f29; font-weight: 700;">block</span>, <span style="color: #ff9f29; font-weight: 700;">inline</span>, or <span style="color: #ff9f29; font-weight: 700;">inline-block</span> 2.

1.3 Floating elements

The <span style="color: #ff9f29; font-weight: 700;">float</span> property moves an element to the far left or right of its container. Surrounding content then reflows around the floated element 3.

📝 Example: A floated image will have text wrap around its right side if floated left, or around its left side if floated right.

1.3.1 Problems with floats

Using floats can lead to common layout issues.

  • Margin collapse: Margins of floated elements do not collapse like they do for non-floated elements.

  • Parent element height: If a parent element contains only floated children, the parent may appear to disappear. The browser assumes it has no height because its children are out of the normal flow 7.

1.4 Positioning elements

The <span style="color: #ff9f29; font-weight: 700;">position</span> property defines how an element is placed on a page. The top, right, bottom, and left properties then control its exact placement.

1.4.1 Relative positioning

With <span style="color: #ff9f29; font-weight: 700;">relative</span> positioning, an element moves from its original spot. It shifts based on where it would have been in the normal flow.

  • Normal flow preservation: Other content retains knowledge of the element's original position. The space it occupied is preserved, and the document flow remains intact 8.

1.4.2 Absolute positioning

Absolute positioning places elements relative to their nearest positioned ancestor. If no ancestor is positioned, it is relative to the initial containing block (usually the viewport).

🔑 Important: Relative positioning is often used to create a positioning context for a subsequent absolutely positioned element.

1.5 Overlapping and hiding elements

CSS allows you to place elements on top of each other and to selectively hide or show content 11.

1.5.1 Hiding elements

There are two primary ways to hide elements:

PropertyEffectSpace Occupied
displayRemoves the element from the flow.No
visibilityHides the element but keeps its space.Yes

🔑 Important: Use display: none; to completely remove an element and its space. Use visibility: hidden; to hide an element while preserving its layout space 12.