HTML Pstudy Notes
HTML Pstudy Notes
HTML NOTES:
HTML
Meaning / Definition
HyperText Markup Language — the core language for creating web pages.
Uses / Purpose
Structures content into elements like headings, paragraphs, lists, forms, etc.
How to Use
Write tags surrounded by < >, e.g. <p>Hello</p>.
Tips
Connections
Works with CSS (styling) and JavaScript (interactivity).
CSS
Meaning / Definition
Cascading Style Sheets — language for styling HTML documents.
Uses / Purpose
Controls layout, colors, fonts, spacing, and overall design.
How to Use
Tips
o Follow CSS best practices (avoid inline styles for large projects).
Connections
Works with HTML and affects how elements appear visually.
Uses / Purpose
Provides the main landing page of a website.
How to Use
Name your home page [Link] or configure the server to recognize a different file.
Tips
Keep index pages clean and lightweight for faster loading.
Connections
Relevant when deploying websites to servers.
Meaning / Definition
The <head> element stores metadata about the HTML document.
Uses / Purpose
Includes:
o <title>
o <meta>
o CSS/JS links
o SEO info
How to Use
Place inside <html> and before <body>.
Tips
Connections
Connects to CSS, JavaScript, SEO.
Meaning / Definition
The <body> element holds all visible page content.
Uses / Purpose
Displays text, images, links, videos, etc.
How to Use
Everything visible goes between <body> and </body>.
Tips
Organize content with semantic tags like <main>, <header>, <footer>.
Connections
Linked to CSS and JavaScript for style and behavior.
Self-Closing Tag
Meaning / Definition
Tags that do not wrap content and close themselves (e.g. <br />).
Uses / Purpose
Insert standalone elements like line breaks or horizontal rules.
How to Use
<tag /> or simply <tag> (HTML5 allows omission of the slash).
Tips
Always check whether a tag requires a closing pair.
Connections
Often used in page layout.
<br>
Meaning / Definition
Line break.
Uses / Purpose
Forces text to move to a new line.
How to Use
<br>
Tips
Connections
Used in text formatting.
<hr>
Meaning / Definition
Horizontal rule, creates a visible line.
Uses / Purpose
Separates content visually.
How to Use
<hr>
Tips
Connections
Used in layouts and section breaks.
<pre>
Meaning / Definition
Preformatted text block.
Uses / Purpose
Preserves spaces, tabs, and line breaks as typed.
How to Use
<pre>
Text
exactly
as typed
</pre>
Tips
Useful for displaying code snippets.
Connections
Related to code formatting.
Hyperlink
Meaning / Definition
Clickable text, image, or element that leads to another page or resource.
Uses / Purpose
Navigate between:
o Web pages
o Sections on a page
o External sites
o Downloads
How to Use
<a href="URL">Link Text</a>
Tips
Connections
Tied to URLs, attributes like href and target.
Meaning / Definition
HTML tag for creating hyperlinks.
Uses / Purpose
Wraps text or elements to make them clickable.
How to Use
Tips
Connections
Related to hyperlinks, URLs.
Attribute Tags
Meaning / Definition
Extra details added to HTML elements as name-value pairs.
Uses / Purpose
Change behavior, appearance, or functionality.
How to Use
<tag attribute="value">
Tips
Connections
Core to writing meaningful HTML.
href
Meaning / Definition
Hypertext reference — the URL where a link points.
Uses / Purpose
Directs the browser to a specific location.
How to Use
<a href="[Link]
Tips
Connections
Used with <a>, <link>, <base>.
target
Meaning / Definition
Specifies where to open the linked document.
Uses / Purpose
Controls browser tab/window behavior.
How to Use
Tips
Connections
Related to hyperlinks.
Absolute URL
Meaning / Definition
A full web address including protocol and domain.
Uses / Purpose
Links to external resources.
How to Use
[Link]
Tips
Necessary when linking outside your website.
Connections
Contrasts with relative URLs.
Relative URL
Meaning / Definition
A URL relative to the current page’s location.
Uses / Purpose
Internal linking within the same website.
How to Use
o [Link]
o ../images/[Link]
Tips
Use relative URLs to keep your site portable.
Connections
Contrasts with absolute URLs.
<img>
Meaning / Definition
Displays images on web pages.
Uses / Purpose
Adds graphics, logos, icons.
How to Use
Tips
Connections
Related to links, folders, multimedia.
src
Meaning / Definition
Specifies the source file for an element.
Uses / Purpose
Used in:
o <img>
o <audio>
o <video>
o <script>
How to Use
<img src="[Link]">
Tips
Paths can be absolute or relative.
Connections
Works with media and external resources.
alt
Meaning / Definition
Alternate text for an image.
Uses / Purpose
How to Use
<img src="[Link]" alt="A cute cat">
Tips
Keep alt text descriptive but concise.
Connections
Related to accessibility.
height/width (Images)
Meaning / Definition
Controls size of images.
Uses / Purpose
Define display dimensions in pixels or percentages.
How to Use
<img src="[Link]" width="200" height="150">
Tips
Use CSS for responsive sizing.
Connections
Works with layout design.
Meaning / Definition
Wrap an image in an <a> tag.
Uses / Purpose
Clickable images.
How to Use
<a href="[Link]
</a>
Tips
Add alt text for accessibility.
Connections
Combines images and links.
Adding GIF
Meaning / Definition
Use animated GIFs like regular images.
Uses / Purpose
Add animations.
How to Use
<img src="[Link]" alt="Funny animation">
Tips
Optimize GIFs to avoid large file sizes.
Connections
Part of multimedia.
Meaning / Definition
Organize images in folders.
Uses / Purpose
Keeps project clean and maintainable.
How to Use
<img src="images/[Link]">
Tips
Maintain consistent folder structure.
Connections
Works with relative paths.
Uses / Purpose
Ensures links and images load correctly.
How to Use
Relative or absolute paths depending on folder structure.
Tips
Double-check paths after moving files.
Connections
Core concept in HTML development.
<audio>
Meaning / Definition
Embeds audio files on a webpage.
Uses / Purpose
Play music, podcasts, sound effects.
How to Use
<audio controls>
</audio>
Tips
Connections
Related to multimedia.
Audio attributes
Uses / Purpose
Improves cross-browser support.
How to Use
Tips
Add multiple sources for compatibility.
Connections
Used in audio and video tags.
<video>
Meaning / Definition
Embeds video content on a webpage.
Uses / Purpose
To display video files like .mp4, .webm, or .ogg.
How to Use
<video controls>
</video>
Tips
Connections
Related to multimedia, like <audio> and <source>.
Video Attributes
Video Codes
Source Code
Icon
Meaning / Definition
Small graphical symbol representing an action, brand, or file.
Uses / Purpose
Used in UI/UX design, favicons, buttons.
How to Use
With <link rel="icon" href="[Link]"> in the <head>.
Tips
Connections
Uses the <link> tag.
<link> Tag
Meaning / Definition
Connects external resources (like stylesheets or icons) to HTML.
Uses / Purpose
Loads CSS files, icons, fonts.
How to Use
Tips
Place inside <head> for CSS loading priority.
Connections
Works with attributes: rel, href, type.
3. Underlined → <u>
4. Deleted → <del>
6. Small → <small>
7. Subscript → <sub>
8. Superscript → <sup>
Tips: Use semantic tags like <strong> or <em> for accessibility and SEO.
span Container
Meaning / Definition
Inline container for text.
Uses / Purpose
Apply styles to part of text without breaking layout.
How to Use
Tips
Use for small style tweaks.
div Container
Meaning / Definition
Block-level container for grouping elements.
Uses / Purpose
Group and apply styles/layouts to multiple elements.
How to Use
<div class="section">
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</div>
Tips
Use semantic tags like <section>, <article> when possible for meaning.
Listing
Bullet points.
Numbered items.
Nestable.
Terms: <dt>
Descriptions: <dd>
Example:
<dl>
<dt>HTML</dt>
</dl>
Tips
Use CSS for spacing, not <br>.
How to Use
Use semicolons to separate properties:
Tips
Use external CSS for cleaner, reusable code.
Tables
Tags
Attributes (HTML-based)
Tips
Buttons
<button> Tag
<a href="[Link]"><button>Go</button></a>
Styling
Use CSS:
border-radius: 10px;
font-size: 20px;
<p id="hello">Hello</p>
<script>
function doThings(){
[Link]("hello").innerHTML = "Goodbye"
}
</script>
Form
<form> Tag
Meaning / Definition
Container that groups user input fields for submission.
Uses / Purpose
Collects data like names, emails, comments, etc.
How to Use
</form>
Tips
Connections
Related to backend processing (e.g. PHP).
action
Meaning / Definition
URL where the form data will be sent upon submission.
Uses / Purpose
Connects front-end form to a server-side script (like PHP).
How to Use
action="[Link]"
Tips
Connections
Works with backend languages (e.g. PHP).
method
Meaning / Definition
Defines how form data is sent to the server.
Values:
o get:
o post:
Tips
Prefer post for logins, passwords, etc.
enctype
Meaning / Definition
Specifies how form data should be encoded.
Values:
o application/x-www-form-urlencoded (default)
How to Use
<form enctype="multipart/form-data">
Connections
Essential for uploading images or files.
<label>
Meaning / Definition
Text label describing a form element.
Uses / Purpose
Improves usability and accessibility.
How to Use
<label for="username">Username:</label>
Tips
Clicking the label focuses the input.
Connections
Works with id attributes.
<input>
Meaning / Definition
Generic tag for capturing user data.
Uses / Purpose
Text fields, checkboxes, radio buttons, file uploads, etc.
Tips
Always add descriptive labels for accessibility.
Connections
Often paired with <label>.
Text Input
Attributes:
o required
o minlength
o maxlength
o placeholder
Password Input
Hides characters.
Email Input
Telephone Input
Number Input
Radio Buttons
Select Dropdown
<select id="payment">
<option value="visa">Visa</option>
</select>
Checkbox
Toggles on/off.
Textarea
Multi-line input.
File Upload
Reset Button
<input type="reset">
Submit Button
<input type="submit">
<header>
Meaning / Definition
Container for introductory or navigational content.
Uses / Purpose
Often includes:
o Logo
o Site name
o Navigation bar
How to Use
<header>
<h1>My Website</h1>
</header>
Connections
Part of semantic HTML.
<footer>
Meaning / Definition
Container for closing or secondary content.
Uses / Purpose
Often includes:
o Copyright info
o Links
o Contact details
How to Use
<footer>
Tips
Use <small> for copyright text.
<main>
Meaning / Definition
Represents the central content of a page.
Uses / Purpose
Focus area for unique content.
How to Use
<main>
<h2>Welcome</h2>
</main>
Connections
Good for SEO and accessibility.
✅ Example:
Bad:
Author: Kervs<br>
Better:
<footer>
<p>Author: Kervs</p>
</footer>
Or using a list:
<footer>
<ul>
<li>Author: Kervs</li>
</ul>
</footer>
Instead of:
✅ Use a class:
<footer class="site-footer">
And CSS:
.site-footer {
background-color: bisque;
padding: 10px;
text-align: center;
e.g. Copyright:
CSS NOTES:
Here’s your expanded version using the Note Expansion Method for your CSS & HTML notes:
Meaning / Definition
A language used to style and visually format HTML elements on a webpage.
Uses / Purpose
o Internal CSS: Inside a <style> tag placed within the <head> of an HTML document.
o External CSS: In a separate .css file linked via <link rel="stylesheet" href="[Link]">.
Connections
ID (#idName)
Class (.className)
o If ID and class both apply a style (e.g., color), the ID takes priority.
o The cascading behavior of CSS means child elements may inherit styles from parent (e.g., styles on
<body>).
CSS Colors
o Hexadecimal: #ff0000
o RGB: rgb(255,0,0)
o Color Picker: Some editors offer GUI color pickers for visual selection.
Uses
CSS Fonts
font-family: ;
Font Sizes
o Google Fonts:
Copy the embed link into <head> and use its font name in CSS.
Use @font-face:
@font-face {
src: url(font/[Link]);
font-family: yourCustomName;
Tips
CSS Borders
Individual Properties
o border-style: solid;
o border-width: 3px;
o border-color: blueviolet;
Shorthand
o Rounded corners have a max value beyond which they don't become more rounded.
Directional Borders
Types of Borders
CSS Shadows
Text Shadow
Box Shadow
Tips
CSS Margins
Definition
Uses
Shorthand
o margin: 10px; (all sides)
Directional
Special Cases
Tools
CSS Floats
Definition
o Allows elements (like images) to float to the left or right, allowing inline content to wrap around them.
How to Use
Common Usage
Problem
Fix
display: flow-root;
CSS Overflow
Definition: Controls what happens when content overflows the bounds of its container.
States:
o **hidden**: Cuts off content that exceeds container bounds. Content is still selectable.
o **clip**: Like hidden, but used with overflow-clip-margin to control how much is clipped.
CSS Display
Definition: Specifies how an element is displayed in the layout (block, inline, etc.).
Types:
o **block-level**: Starts on a new line; takes full width. e.g., <div>, <p>, <h1>.
o **inline**: Stays on the same line; only takes up necessary width. e.g., <span>, <a>, <img>.
Common Values:
Also Related: visibility (e.g., visibility: hidden; hides but retains space).
Properties:
height, width, min-height, max-height, min-width, max-width, text-align
Tip:
CSS Position
Values:
o **relative**: Moves from its normal position using top, left, etc.
Tip: Use relative for small nudges, absolute for floating inside containers, fixed for headers/menus.
CSS Background-Image
Key Properties:
o background-image: url('...');
o background-repeat: no-repeat;
o background-position: center;
o background-attachment: fixed;
o background-size: cover;
Tip: Use cover for full-element fit and fixed for parallax-style effects.
CSS Combinators
Types:
CSS Pseudo-Classes
Common Pseudo-Classes:
o Example: selector:not(:hover)
nth-child() Variants:
o nth-child(even) / odd
#greeting p {
display: none;
}
#greeting:hover p {
display: block;
}
CSS Pseudo-Elements
Common Pseudo-Elements:
Examples:
h1::first-letter {
font-size: 2em;
}
#fruit li::before {
content: "🫠";
}
#Banana::after {
content: "🍌🍌";
}
Tip: Great for icons, decorative elements, or content embellishment without extra tags.
CSS Pagination
Meaning:
o A technique used to divide long content (like articles or search results) into multiple pages, making it
easier to navigate.
.pagination {
text-align: center;
}
.pagination a {
color: black;
text-decoration: none;
display: inline-block;
}
.pagination [Link] {
font-weight: bold;
border-radius: 5px;
}
.pagination a:hover:not(.active) {
background-color: beige;
border-radius: 5px;
}
How It Works:
Tips:
Connected Topics:
Meaning:
o A UI component that shows a list of links or options when a button or element is hovered or clicked.
.dropdown {
display: inline-block;
}
.dropdown button {
color: aliceblue;
border: none;
cursor: pointer;
}
.dropdown .content {
display: none;
position: absolute;
min-width: 100px;
}
.dropdown:hover .content {
display: block;
}
.dropdown a {
display: block;
color: black;
text-decoration: none;
}
.dropdown a:hover {
background-color: aquamarine;
}
.dropdown:hover button {
background-color: aqua;
}
How It Works:
Tips:
o Avoid relying only on :hover for mobile — consider JavaScript for touch interaction.
Connected Topics:
Personal Note:
Meaning:
o A structured block of links that let users move through different parts of a website.
o <nav class="navbar"> contains an unordered list <ul> with navigation links <li><a></a></li>.
.navbar ul {
list-style-type: none;
background-color: bisque;
padding: 0;
margin: 0;
overflow: hidden;
}
.navbar li {
float: left;
}
.navbar a {
display: block;
color: brown;
text-decoration: none;
padding: 15px;
text-align: center;
}
.navbar a:hover {
background-color: burlywood;
}
How It Works:
Tips:
Connected Topics:
Meaning:
o Structuring a full web page using semantic HTML and styled using CSS for layout and responsiveness.
Semantic Tags:
o <header>, <nav>, <main>, <section>, <aside>, <article>, <footer> — each has a specific purpose for
content structure and accessibility.
*{
box-sizing: border-box;
}
float: left;
padding: 15px;
}
width: 100%;
}
}
How It Works:
Tips:
Connected Topics:
CSS Icon
o A widely-used icon library that offers scalable vector icons (SVG) and social brand icons.
o Icons are added using <i> or <span> tags with specific Font Awesome classes.
o Example:
o Icons inside anchor tags (<a>) are clickable links—using target="_blank" opens them in a new tab.
o Combine with hover effects, animations, or Flexbox for better layout control.
CSS Flexbox
display: flex
flex-direction
justify-content
align-items
flex-wrap
o Allows items to wrap into multiple lines: nowrap (default), wrap, wrap-reverse.
align-content
column-gap / row-gap
align-self
order
CSS Transformations
What it is:
Units:
Translate
translate(x, y)
translateX() / translateY()
Rotate
Scale
scale(x, y)
scaleX() / scaleY()
Skew
skew(x, y)
skewX() / skewY()
Multiple Transformations
Tips
CSS Animations
@keyframes Rule
o Example:
o @keyframes slide {
o to { transform: translateX(100px); }
o }
Percentage Explanation
animation-iteration-count
animation-timing-function
animation-direction
animation-play-state
o Starts/stops animation:
running, paused
Applying to Hover
o Example:
o #box:hover {
o animation-name: glow;
o animation-duration: 2s;
o animation-iteration-count: 1;
o animation-direction: alternate-reverse;
o animation-play-state: running;
o animation-timing-function: ease-in-out;
o }
@keyframes kahitano
@keyframes slideright
to { transform: translateX(1000%); }
@keyframes rotate
@keyframes fade
@keyframes colorChange
@keyframes glow
Connection Tip:
o Combine keyframes with hover states, transitions, and transform for interactive animations.