In main.css
-body{ font-family: Geneva, Arial, Helvetica, sans-serif; margin: 2em; }
+body{ font-family: Geneva, Arial, Helvetica, sans-serif; margin: 2em; }
#mainbody {
padding: 1em;
@@ -114,7 +114,7 @@ In main.css
In defaultColors.css
-body, p {
+body, p {
color:#000000;
background-color:#FFFFFF;
}
@@ -128,14 +128,14 @@ In defaultColors.css
In altColors1.css
-body, h1, h2, h3, p, a {
+body, h1, h2, h3, p, a {
color:#000066;
background-color:#FFFFFF;
}
In altColors2.css
-body, h1, h2, h3, p, a {
+body, h1, h2, h3, p, a {
color:#FFFF33;
background-color:#000000;
}
@@ -143,7 +143,7 @@ In altColors2.css
In altColors3.css
-body, h1, h2, h3, p, a {
+body, h1, h2, h3, p, a {
color:#000000;
background-color:#FFFF99;
}
@@ -151,7 +151,7 @@ In altColors3.css
In altColors4.css
-body, h1, h2, h3, p, a {
+body, h1, h2, h3, p, a {
color:#000000;
background-color:#FFFFFF;
}
@@ -161,7 +161,7 @@ In altColors4.css
The JavaScript components
-function changeColors (newCSS){
+function changeColors (newCSS){
document.getElementById('currentCSS').href = newCSS;
}
@@ -178,7 +178,7 @@ Using a client-side JavaScript to change a CSS property
The HTML components
-<h1>Product comparison</h1>
+<h1>Product comparison</h1>
<p>The products you selected to compare are listed below.
Any differences between the products are highlighted and italicized.</p>
<p class="inlinePara">Change hightlight color: </p>
@@ -233,7 +233,7 @@ The HTML components
The CSS components
-body { color:#000000; background-color:#FFFFFF; }
+body { color:#000000; background-color:#FFFFFF; }
.hghltLightYellow { color: #000000; background-color: #FFFF99; font-style:oblique; }
.hghltBrightYellow { color: #000000; background-color: #FFFF00; font-style:oblique; }
.hghltLightBlue { color: #000000; background-color: #33FFFF; font-style:oblique; }
@@ -249,7 +249,7 @@ The CSS components
The JavaScript components
-function changeColor(hghltColor) {
+function changeColor(hghltColor) {
// collects table data cells into an array
var els = document.getElementsByTagName('td');
@@ -276,7 +276,7 @@ Using PHP $_GET to apply a different external CSS file
The PHP and HTML components
At the beginning of the PHP page
-<?php
+<?php
$thestyle = $_GET['set'];
if ($thestyle == "style1") {
$thestyle = "style2";
@@ -289,11 +289,11 @@ At the beginning of the PHP page
In the <head> section
-<link rel="stylesheet" media="screen" href="<?php echo($thestyle);?>.css">
+<link rel="stylesheet" media="screen" href="<?php echo($thestyle);?>.css">
In <body> section
-<?php
+<?php
if ($thestyle == "style1") {
echo "<a href=\"index.php?set=style1\">Switch to Style Sheet Two</a>";
}
@@ -315,13 +315,13 @@ The CSS components
In style1.css
-body, p { color:#000000; background-color:#FFFFFF; }
+body, p { color:#000000; background-color:#FFFFFF; }
h1, h2, h3 {color:#990000; background-color:#FFFFFF; }
In style2.css
-body, h1, h2, h3, p, a { color:#FFFF00; background-color:#000000; }
+body, h1, h2, h3, p, a { color:#FFFF00; background-color:#000000; }
diff --git a/techniques/css/C30.html b/techniques/css/C30.html
index 7bce41a50e..3681f0a49b 100644
--- a/techniques/css/C30.html
+++ b/techniques/css/C30.html
@@ -31,7 +31,7 @@ Replacing heading text with images of text
A design studio site uses a style switcher to allow users to view two presentations of their home page. For the default version, the heading text is replaced with images of text. A control on the page allows users to switch to a version that presents the headings as text.
The HTML component
-<div id="Header">
+<div id="Header">
<h1><span>Pufferfish Design Studio</span></h1>
<h2><span>Surprising Identity and Design Solutions</span></h2>
</div>
@@ -41,7 +41,7 @@ The HTML component
The CSS for the presentation that includes images of text
Note that the CSS uses positioning to place the contents of the heading elements offscreen so that the text remains available to screen reader users.
-#Header h1 {
+#Header h1 {
background-image: url(pufferfish-logo.png);
height: 195px;
width: 290px;
@@ -72,7 +72,7 @@ The CSS for the presentation that includes images of text
The CSS for the presentation that does not include images of text
-#Header h1 {
+#Header h1 {
font: normal 200%/100% Garamond, "Times New Roman", serif;
margin-bottom: 0;
color: #000099;
diff --git a/techniques/css/C31.html b/techniques/css/C31.html
index 4b24b62315..0afbea3fdd 100644
--- a/techniques/css/C31.html
+++ b/techniques/css/C31.html
@@ -34,7 +34,7 @@ Example 1: Medium complex flexbox layout in
-
+
<!DOCTYPE html>
<html lang="en">
<head>
diff --git a/techniques/css/C32.html b/techniques/css/C32.html
index fa2a9eba5a..c1756567b3 100644
--- a/techniques/css/C32.html
+++ b/techniques/css/C32.html
@@ -34,7 +34,7 @@ Grid layout in HTML and CSS - Medium complexity
The following medium complexity example uses HTML and CSS to create a grid layout. The layout regions adjust their size as the viewport is adjusted. When the total viewport width matches the width defined via media queries, columns wrap to be positioned below, rather than beside each other or vice versa.
The zoom level can be increased to 400% without requiring scrolling in more than one direction. This particular example uses fr units as a fraction of the free space of the grid container for the grid items by using the "grid-template-columns" property and are laid out in source order.
-
+
<!DOCTYPE html>
<html lang="en">
<head>
diff --git a/techniques/css/C33.html b/techniques/css/C33.html
index f01d536ed9..71231c77b1 100644
--- a/techniques/css/C33.html
+++ b/techniques/css/C33.html
@@ -30,10 +30,10 @@ Breaking long URLs
Using the following CSS will cause long URLs to break at appropriate places (hyphens, forward slashes, etc.) and within words without causing reflow.
List of CSS declarations used and why they are used:
- overflow-wrap: break-word
: Allows words to be broken and wrapped within words.
- word-wrap: break-word
: Allows words to be broken and wrapped within.
+ overflow-wrap: break-word
: Allows words to be broken and wrapped within words.
+ word-wrap: break-word
: Allows words to be broken and wrapped within.
-a {
+a {
overflow-wrap: break-word;
word-wrap: break-word;
}
diff --git a/techniques/css/C34.html b/techniques/css/C34.html
index 5b8127580c..a127ec4b09 100644
--- a/techniques/css/C34.html
+++ b/techniques/css/C34.html
@@ -20,7 +20,7 @@ When to Use
Description
- The objective of this technique is to be able to present content with sticky headers and footers when there is enough space. This is done by using min-height
, max-height
, and min-width
media queries techniques that adapt to the available space of the viewport.
+ The objective of this technique is to be able to present content with sticky headers and footers when there is enough space. This is done by using min-height
, max-height
, and min-width
media queries techniques that adapt to the available space of the viewport.
Sticky regions always stay visible in the viewport while the other content will disappear underneath when scrolling. In terms of content visibility, this is often not a problem on the desktop and on mobile devices in portrait orientation. However, when using mobile devices in landscape orientation or when zooming in on the desktop, sticky regions may block a big portion of the screen: the height of the sticky region may leave only a small part of the screen for the display of page content.
@@ -30,9 +30,9 @@ Description
The basic approach for un-fixing sticky headers / footers is to:
- - Define the first sticky regions using media query
min-height
properties, so they get fixed or un-fixed depending on the available space;
+ - Define the first sticky regions using media query
min-height
properties, so they get fixed or un-fixed depending on the available space;
- - Define other sticky regions using media query
min-width
and max-height
properties for specific viewport sizes, so they get fixed or un-fixed depending on the available space, e.g. for tablets depending on the portrait or landscape position of the device.
+ - Define other sticky regions using media query
min-width
and max-height
properties for specific viewport sizes, so they get fixed or un-fixed depending on the available space, e.g. for tablets depending on the portrait or landscape position of the device.
@@ -40,8 +40,8 @@ Description
Examples
Un-fix sticky headers / footers in HTML and CSS
- The following example uses HTML and CSS to un-fix sticky headers / footers. The sticky regions get un-fixed as the height of the viewport is limited or the orientation is changed. When the min-height
property matches the viewport space defined via media queries, regions which are not sticky get fixed or vice versa. This particular example uses the CSS min-height
, max-height
and min-width
media query properties.
-
+ The following example uses HTML and CSS to un-fix sticky headers / footers. The sticky regions get un-fixed as the height of the viewport is limited or the orientation is changed. When the min-height
property matches the viewport space defined via media queries, regions which are not sticky get fixed or vice versa. This particular example uses the CSS min-height
, max-height
and min-width
media query properties.
+
<!DOCTYPE html>
<html lang="en">
<head>
diff --git a/techniques/css/C35.html b/techniques/css/C35.html
index 5d733d17e2..5ae9614f63 100644
--- a/techniques/css/C35.html
+++ b/techniques/css/C35.html
@@ -24,18 +24,18 @@ Description
- allow the containers to expand in the direction of text.
There is some variability in the width that words or phrases will grow to when setting the letter and word spacing. If elements must use a fixed width, a safe value is 20% wider than the default maximum width. For example, if a small text-container allows for 20 characters, allowing enough width for 24 characters should allow enough space for text-spacing to be applied.
- For boxes which can expand with the text, authors can take advantage of the inline-block
value of the CSS display
property and not set negative margins to allow for text-spacing overrides.
+ For boxes which can expand with the text, authors can take advantage of the inline-block
value of the CSS display
property and not set negative margins to allow for text-spacing overrides.
Examples
When a user adapts the page to increase the text spacing, text fits within the bounds of its containing box.
- The ex
unit has been used as as the closest available unit for character width, ex
Represents the x-height of the element's font.
(MDN page for CSS units). It is not perfect, different characters have different default widths.
+ The ex
unit has been used as as the closest available unit for character width, ex
Represents the x-height of the element's font.
(MDN page for CSS units). It is not perfect, different characters have different default widths.
A box sized with space to allow for expansion
The containers are sized to a value greater than the default width of the text.
The CSS
-<style>
+<style>
/* Links are less than 8ex wide,
so 10ex width of each li allows for expanded letter and word width */
nav li { width: 10em; }
@@ -44,7 +44,7 @@ The CSS
The HTML
-<nav>
+<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/contact/">Contact</a></li>
@@ -57,7 +57,7 @@ The HTML
A box which expands with the text size
The CSS
-<style>
+<style>
/* CSS containers are given a display of inline-block. No negative margins set. */
nav li { display: inline-block; }
</style>
@@ -65,7 +65,7 @@ The CSS
The HTML
-<nav>
+<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/contact/">Contact</a></li>
diff --git a/techniques/css/C36.html b/techniques/css/C36.html
index f8371e1ac9..86b4a47e72 100644
--- a/techniques/css/C36.html
+++ b/techniques/css/C36.html
@@ -17,7 +17,7 @@ Metadata
Description
The objective of this technique is to allow a user to override text spacing via user stylesheet, bookmarklet, extension, or application. Increased spacing between paragraphs, lines, words, and characters benefits people with low vision or some cognitive disabilities. Content needs to allow spacing changes without loss of content or functionality, so text containers must either have room for the text to expand or the container must be able to expand. This technique will typically apply to short strings of text such as in a navigation bar, as longer strings of text are increasingly likely to require wrapping to be readable when styles are changed.
- In English languages, if authors do not set the CSS height
property, it can help ensure paragraphs expand. Paragraphs need to allow text to increase vertically for languages or scripts such as English which are read horizontally or to increase horizontally for languages or scripts which are read vertically.
+ In English languages, if authors do not set the CSS height
property, it can help ensure paragraphs expand. Paragraphs need to allow text to increase vertically for languages or scripts such as English which are read horizontally or to increase horizontally for languages or scripts which are read vertically.
Examples
@@ -27,11 +27,11 @@ Examples
A paragraph expands vertically within container
The CSS
-<style>
+<style>
/* CSS: No height property is set.*/
</style>
The HTML
-<div class="card">
+<div class="card">
<img alt="" src="image.png">
<h3>Heading</h3>
<p class="lede">Long lede paragraph...</p>
diff --git a/techniques/css/C37.html b/techniques/css/C37.html
index 677414f4cb..76d85b1641 100644
--- a/techniques/css/C37.html
+++ b/techniques/css/C37.html
@@ -5,7 +5,7 @@
- Using CSS max-width
and height
to fit images
+ Using CSS max-width
and height
to fit images
Metadata
@@ -18,13 +18,13 @@ When to Use
Description
- The objective of this technique is to be able to present images without introducing a horizontal scroll bar at a width equivalent to 320 CSS pixels, or a vertical scroll bar at a height equivalent to 256 CSS pixels for content intended to scroll horizontally. This is done by using CSS max-width
and height
property techniques that adapt to the available space and keep the original dimensions of the image.
+ The objective of this technique is to be able to present images without introducing a horizontal scroll bar at a width equivalent to 320 CSS pixels, or a vertical scroll bar at a height equivalent to 256 CSS pixels for content intended to scroll horizontally. This is done by using CSS max-width
and height
property techniques that adapt to the available space and keep the original dimensions of the image.
Responsive layouts can add or remove columns or layout blocks, and each part of the layout can be wider or smaller at different points. This technique ensures images do not break out of their layout area, including in one-column layouts where it would cause scrolling.
The basic principles of fitting images are to:
- - Define the