0% found this document useful (0 votes)
4 views18 pages

HTML & CSS Cheat Sheet Guide

The document is an ultimate cheat sheet for HTML and CSS, outlining the basic structure of an HTML document, including elements like <head>, <title>, <meta>, <link>, <script>, and <body>. It also covers HTML headings, paragraphs, lists, links, images, CSS selectors, and properties, providing examples for each. Key CSS properties related to typography, box model, backgrounds, display/layout, effects, and animation are also highlighted.

Uploaded by

Moriel Golbahar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views18 pages

HTML & CSS Cheat Sheet Guide

The document is an ultimate cheat sheet for HTML and CSS, outlining the basic structure of an HTML document, including elements like <head>, <title>, <meta>, <link>, <script>, and <body>. It also covers HTML headings, paragraphs, lists, links, images, CSS selectors, and properties, providing examples for each. Key CSS properties related to typography, box model, backgrounds, display/layout, effects, and animation are also highlighted.

Uploaded by

Moriel Golbahar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HTML & CSS Ultimate Cheat Sheet

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.
HTML & CSS Ultimate Cheat Sheet
<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
HTML & CSS Ultimate Cheat Sheet
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


HTML & CSS Ultimate Cheat Sheet
Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
HTML & CSS Ultimate Cheat Sheet
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.
HTML & CSS Ultimate Cheat Sheet
<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}
HTML & CSS Ultimate Cheat Sheet
CSS Properties and Their Effects
CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


HTML & CSS Ultimate Cheat Sheet
Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
HTML & CSS Ultimate Cheat Sheet
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
HTML & CSS Ultimate Cheat Sheet
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}
HTML & CSS Ultimate Cheat Sheet

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
HTML & CSS Ultimate Cheat Sheet
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
HTML & CSS Ultimate Cheat Sheet
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
HTML & CSS Ultimate Cheat Sheet
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


HTML & CSS Ultimate Cheat Sheet
CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}

HTML Document Structure


Every HTML document begins with the <!DOCTYPE html> declaration which tells the browser that the document is
HTML & CSS Ultimate Cheat Sheet
HTML5.
The root element is <html>, which wraps everything. Inside it, we have:

- <head>: Contains metadata, title, links to stylesheets, scripts, and more. It doesn't display content.
- <title>: Sets the tab/browser title.
- <meta>: Describes metadata like charset, viewport settings.
- <link>: Links to external stylesheets or icons.
- <script>: Embeds or links to JavaScript.
- <body>: The visible content of the webpage.

Structure Example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
</body>
</html>

HTML Headings, Paragraphs, and Text Formatting


Headings define content hierarchy: <h1> is the most important, <h6> the least.
Paragraphs are defined with <p>. Use semantic tags for emphasis:
- <strong>: Important text (usually bold).
- <em>: Emphasized text (usually italic).
- <mark>: Highlighted text.
- <small>: Smaller text.
- <del>, <ins>: Deleted or inserted content.

<h1>Main Heading</h1>
<p>This is a <strong>very</strong> important paragraph with <em>emphasis</em>.</p>
<p><mark>Note:</mark> This is highlighted.</p>

HTML Lists, Links, and Images


Lists:
- Unordered: <ul><li>Item</li></ul>
- Ordered: <ol><li>Item</li></ol>

Links use <a href='url'>text</a>. Add target="_blank" to open in a new tab.


Images use <img src='path' alt='description'>. Always include 'alt' for accessibility.

<ul>
<li>Apples</li>
<li>Oranges</li>
HTML & CSS Ultimate Cheat Sheet
</ul>
<a href="[Link] target="_blank">Visit Example</a>
<img src="[Link]" alt="A cute cat">

CSS Selectors - Targeting HTML Elements


CSS selectors define which HTML elements you want to style:
- Element selector: p { color: red; }
- Class selector: .menu { ... }
- ID selector: #header { ... }
- Attribute selector: input[type="text"]
- Descendant selector: div p (all <p> inside <div>)
- Child selector: div > p (only direct children)
- Adjacent sibling: h1 + p
- Pseudo-classes: a:hover, input:focus
- Pseudo-elements: p::first-letter, p::before

p {
color: red;
}

.menu {
background: #eee;
}

#header {
height: 60px;
}

input[type="text"] {
border: 1px solid #ccc;
}

CSS Properties and Their Effects


CSS properties control styling. Some major groups:

- Typography: font-family, font-size, font-weight, line-height, text-align, color


- Box Model: width, height, padding, margin, border, box-sizing
- Backgrounds: background-color, background-image, background-size
- Display/Layout: display, position, top/right/bottom/left, float, clear, z-index
- Effects: box-shadow, text-shadow, opacity, transform
- Animation: transition, animation, keyframes

Use 'inherit', 'initial', or 'unset' to control default behavior.

body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f9f9f9;
margin: 0;
HTML & CSS Ultimate Cheat Sheet
padding: 0;
}

You might also like