### Text-based UA formatting of first-letter example Source: https://www.w3.org/TR/REC-CSS1-961217 Possible text-based formatting of the drop cap example, showing the first letter as a large block and the rest of the text wrapped around it. ```text ___ | HE FIRST few | words of an article in the Economist. ``` -------------------------------- ### background-position keyword examples Source: https://www.w3.org/TR/REC-CSS1-961217 Shows equivalent keyword values for background-position with percentage equivalents. Keywords cannot be combined with percentage or length values. ```css BODY { background: url(banner.jpeg) right top } /* 100% 0% */ BODY { background: url(banner.jpeg) top center } /* 50% 0% */ BODY { background: url(banner.jpeg) center } /* 50% 50% */ BODY { background: url(banner.jpeg) bottom } /* 50% 100% */ ``` -------------------------------- ### line-height: equivalent values example Source: https://www.w3.org/TR/REC-CSS1-961217 Shows three equivalent ways to set line-height: number, length, and percentage. All produce the same resultant line height. ```css DIV { line-height: 1.2; font-size: 10pt } /* number */ DIV { line-height: 1.2em; font-size: 10pt } /* length */ DIV { line-height: 120%; font-size: 10pt } /* percentage */ ``` -------------------------------- ### Class selector example Source: https://www.w3.org/TR/REC-CSS1-961217 Complete HTML document using a class selector to style an H1 element with a specific color. ```html
Some text that ends up on two lines
``` -------------------------------- ### text-indent: 3em example Source: https://www.w3.org/TR/REC-CSS1-961217 Indents the first formatted line of a paragraph by 3em. Negative values allowed but may have implementation limits. ```css P { text-indent: 3em } ``` -------------------------------- ### Visual markup with FONT element Source: https://www.w3.org/TR/REC-CSS1-961217 HTML example showing visual markup using a FONT element to achieve small-caps style, contrasted with the CSS1 style sheet approach. ```htmlWhile the paragraph is green. ``` -------------------------------- ### ID selector examples Source: https://www.w3.org/TR/REC-CSS1-961217 Shows ID selectors: one matches any element with ID 'z98y', the other only matches H1 elements with that ID. Also shows an HTML element with that ID. ```css #z98y { letter-spacing: 0.3em } H1#z98y { letter-spacing: 0.5em } ``` ```html
Wide text
``` -------------------------------- ### Set padding with shorthand and background (padding) Source: https://www.w3.org/TR/REC-CSS1-961217 Shorthand for setting all four padding values. One value applies to all sides; two values set vertical and horizontal; three values set top, horizontal, and bottom; four values set top, right, bottom, left. The example sets 1em vertical and 2em horizontal padding on an H1 with a white background. Padding values cannot be negative. ```css H1 { background: white; padding: 1em 2em; } ``` -------------------------------- ### text-transform: uppercase example Source: https://www.w3.org/TR/REC-CSS1-961217 Applies uppercase transformation to H1 elements. The actual transformation is language dependent. ```css H1 { text-transform: uppercase } ``` -------------------------------- ### Importing style sheets with @import Source: https://www.w3.org/TR/REC-CSS1-961217 Shows how to combine partial style sheets using @import statements. All @import statements must occur at the start of a style sheet, before any declarations. Rules in the style sheet itself override imported sheets. ```css @import url(http://www.style.org/pastoral); @import url(http://www.style.org/marine); H1 { color: red } /* override imported sheets */ ``` -------------------------------- ### margin-top: 2em example Source: https://www.w3.org/TR/REC-CSS1-961217 Sets the top margin of H1 elements to 2em. Negative values allowed but may have implementation limits. ```css H1 { margin-top: 2em } ``` -------------------------------- ### Set background-image with url and none Source: https://www.w3.org/TR/REC-CSS1-961217 Sets the background image of an element. The example sets a background image for BODY using a URL and disables it for P elements with 'none'. When setting an image, also set a background color for when the image is unavailable. ```css BODY { background-image: url(marble.gif) } P { background-image: none } ``` -------------------------------- ### Basic contextual selector example: H1 EM Source: https://www.w3.org/TR/REC-CSS1-961217 Shows a simple style rule where EM elements inside H1 are colored red. The first part sets H1 to blue and EM to red, but the second part uses a contextual selector to target only EM elements within H1. ```css H1 { color: blue } EM { color: red } ``` ```css H1 EM { color: red } ``` -------------------------------- ### Drop cap with first-letter pseudo-element Source: https://www.w3.org/TR/REC-CSS1-961217 HTML and CSS example showing how to create a drop cap that spans two lines using the 'first-letter' pseudo-element with 'float: left' and increased font size. ```htmlThe first few words of an article in The Economist.
``` -------------------------------- ### word-spacing example Source: https://www.w3.org/TR/REC-CSS1-961217 Increases word spacing by 0.4em for H1 elements. The length unit adds to the default space between words. ```css H1 { word-spacing: 0.4em } ``` -------------------------------- ### Example of a block with nested quotes and escaped characters Source: https://www.w3.org/TR/REC-CSS1-961217 Illustrates a block in CSS1, showing that braces inside quotes do not match the opening brace and that escaped characters are handled specially. ```css { causta: "}" + ({7} * '\'') } ``` -------------------------------- ### Fictional tag sequence for multiple pseudo-elements Source: https://www.w3.org/TR/REC-CSS1-961217 The fictional tag sequence for the multiple pseudo-elements example, showing the nesting of 'first-letter' inside 'first-line'. ```html
First paragraph
```
--------------------------------
### Set border-width with one to four values (H1)
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows the shorthand 'border-width' property with one to four values. The comments indicate the resulting widths for top, right, bottom, and left borders.
```css
H1 { border-width: thin } /* thin thin thin thin */
H1 { border-width: thin thick } /* thin thick thin thick */
H1 { border-width: thin thick medium } /* thin thick medium thin */
H1 { border-width: thin thick medium none } /* thin thick medium none */
```
--------------------------------
### Set image width (IMG.icon { width: 100px })
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the width of an image element. The aspect ratio is preserved if the 'height' property is 'auto'. Negative values are not allowed.
```css
IMG.icon { width: 100px }
```
--------------------------------
### Simple CSS rule setting H1 color to blue
Source: https://www.w3.org/TR/REC-CSS1-961217
A basic CSS rule with selector 'H1' and declaration 'color: blue'. This is the simplest form of a style sheet.
```css
H1 { color: blue }
```
--------------------------------
### Set display types for HTML elements with CSS 'display' property
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets display values for P, EM, LI, and IMG elements. The last rule turns off the display of images.
```css
P { display: block }
EM { display: inline }
LI { display: list-item }
IMG { display: none }
```
--------------------------------
### Set font-style for headings and emphasized text
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets H1, H2, H3 to italic and H1 EM to normal. Emphasized text within H1 will appear in a normal face.
```css
H1, H2, H3 { font-style: italic }
H1 EM { font-style: normal }
```
--------------------------------
### Class selector for all elements
Source: https://www.w3.org/TR/REC-CSS1-961217
Selects all elements with the class 'pastoral' and sets their color to green.
```css
.pastoral { color: green } /* all elements with CLASS pastoral */
```
--------------------------------
### Set border-style with two values (#xy34)
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the border style using the 'border-style' property with two values. The horizontal borders will be 'solid' and the vertical borders will be 'dotted'.
```css
#xy34 { border-style: solid dotted }
```
--------------------------------
### Set border width with em unit (H1)
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the border width using the 'em' unit to achieve relative widths that scale with font size.
```css
H1 { border: solid 0.5em }
```
--------------------------------
### Set font-weight bolder
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets STRONG to bolder, selecting a font weight relative to the inherited weight.
```css
STRONG { font-weight: bolder }
```
--------------------------------
### Invalid at-keyword ignored: @three-dee
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows that an invalid at-keyword is ignored together with everything following it up to the next semicolon or brace pair. The whole @three-dee at-rule is skipped, effectively reducing the style sheet to the remaining rule.
```css
@three-dee {
@background-lighting {
azimuth: 30deg;
elevation: 190deg;
}
H1 { color: red }
}
H1 {color: blue}
```
```css
H1 {color: blue}
```
--------------------------------
### Set border width with keyword values (H1 and P)
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the top border width using the 'thick' keyword for H1 and P elements. The keyword widths are constant throughout a document, so both elements will have the same border width regardless of font size.
```css
H1 { border: solid thick red }
P { border: solid thick blue }
```
--------------------------------
### CSS comments: EM { color: red } /* red, really red!! */
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows the syntax for comments in CSS, which are similar to C comments. Comments cannot be nested and are treated as whitespace by a CSS1 parser.
```css
EM { color: red } /* red, really red!! */
```
--------------------------------
### Set font-variant small-caps and font-style oblique
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets H3 to small-caps and EM to oblique, resulting in emphasized words in oblique small-caps.
```css
H3 { font-variant: small-caps }
EM { font-style: oblique }
```
--------------------------------
### Set left margin with em unit (margin-left)
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the left margin of an element to 2em. Negative values are allowed but may have implementation-specific limits.
```css
H1 { margin-left: 2em }
```
--------------------------------
### Set bottom border with color (H1 { border-bottom: thick solid red })
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the width, style, and color of the bottom border of an H1 element. The color is explicitly set to red.
```css
H1 { border-bottom: thick solid red }
```
--------------------------------
### CSS1 parser encountering an illegal @import after rules
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows a style sheet with a second @import that is illegal because it appears after a ruleset. The CSS1 parser skips the entire at-rule, effectively reducing the style sheet to the first @import and the H1 rule.
```css
@import "subs.css";
H1 { color: blue }
@import "list.css";
```
```css
@import "subs.css";
H1 {color: blue}
```
--------------------------------
### CSS1 style sheet for small-caps
Source: https://www.w3.org/TR/REC-CSS1-961217
CSS1 style sheet declaration that replaces the FONT element approach for small-caps, followed by the corresponding HTML markup.
```css
H1 { font-style: small-caps }
```
```html
```
--------------------------------
### Border shorthand equivalent to four individual border properties
Source: https://www.w3.org/TR/REC-CSS1-961217
The first rule sets the same border on all four sides. The second rule shows the equivalent using individual border properties. The 'border' property cannot set different values per side.
```css
P { border: solid red }
P {
border-top: solid red;
border-right: solid red;
border-bottom: solid red;
border-left: solid red
}
```
--------------------------------
### Grouping declarations for H1
Source: https://www.w3.org/TR/REC-CSS1-961217
Groups multiple declarations for H1, setting font-weight, font-size, line-height, font-family, font-variant, and font-style.
```css
H1 {
font-weight: bold;
font-size: 12pt;
line-height: 14pt;
font-family: helvetica;
font-variant: normal;
font-style: normal;
}
```
--------------------------------
### Set image height with CSS 'height' property
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the height of an image with class 'icon' to 100 pixels. The aspect ratio is preserved if the 'width' property is 'auto'. Negative values are not allowed.
```css
IMG.icon { height: 100px }
```
--------------------------------
### Pseudo-element combined with class
Source: https://www.w3.org/TR/REC-CSS1-961217
CSS rule and HTML markup showing how to combine a class with a pseudo-element, making the first letter of elements with that class red.
```css
P.initial:first-letter { color: red }
```
```html
Headline
```
--------------------------------
### Percentage value for line-height
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows that line-height percentage is relative to font-size. Children inherit the computed value (12pt), not the percentage.
```css
P { font-size: 10pt }
P { line-height: 120% } /* relative to 'font-size', i.e. 12pt */
```
--------------------------------
### Set bottom border without color (H1 { border-bottom: thick solid })
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the width and style of the bottom border, omitting the color. The border color will be the same as the element's 'color' value.
```css
H1 { border-bottom: thick solid }
```
--------------------------------
### Unknown property ignored: H1 { color: red; rotation: 70deg }
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows that a declaration with an unknown property is ignored, so the UA treats the style sheet as if only the valid declaration remained.
```css
H1 { color: red; rotation: 70deg }
```
```css
H1 { color: red; }
```
--------------------------------
### Float images left with CSS 'float' property
Source: https://www.w3.org/TR/REC-CSS1-961217
Places all IMG elements with CLASS=icon along the left side of the parent element, with text wrapping on the right. The element is treated as block-level, ignoring the 'display' property.
```css
IMG.icon {
float: left;
margin-left: 0;
}
```
--------------------------------
### Grouping selectors with comma-separated list
Source: https://www.w3.org/TR/REC-CSS1-961217
Groups selectors H1, H2, H3 to apply the same font-family, reducing style sheet size.
```css
H1, H2, H3 { font-family: helvetica }
```
--------------------------------
### Set bottom margin with length (margin-bottom)
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the bottom margin of an element to 3px. Negative values are allowed but may have implementation-specific limits.
```css
H1 { margin-bottom: 3px }
```
--------------------------------
### Pseudo-element in contextual selector
Source: https://www.w3.org/TR/REC-CSS1-961217
CSS rule showing that pseudo-elements are only allowed at the end of a contextual selector.
```css
BODY P:first-letter { color: purple }
```
--------------------------------
### Illegal values ignored: IMG { float: left } and others
Source: https://www.w3.org/TR/REC-CSS1-961217
Illustrates that illegal values or values with illegal parts are treated as if the declaration weren't there at all. The CSS1 parser honors the first rule and ignores the rest, as if the style sheet had the empty declarations.
```css
IMG { float: left } /* CSS1 */
IMG { float: left top } /* "top" is not a value of 'float' */
IMG { background: "red" } /* keywords cannot be quoted in CSS1 */
IMG { border-width: 3 } /* a unit must be specified for length values */
```
```css
IMG { float: left }
IMG { }
IMG { }
IMG { }
```
--------------------------------
### HTML element with emphasized text
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows an H1 element containing an EM element. The EM will inherit the color from its parent if no color is assigned to it.
```html
The headline is important!
```
--------------------------------
### Hiding STYLE content with SGML comments
Source: https://www.w3.org/TR/REC-CSS1-961217
During a transition phase, STYLE element content may be hidden using SGML comments. Since STYLE is CDATA, conforming SGML parsers will not remove the comment.
```html
```
--------------------------------
### CSS1 parser skipping an illegal selector
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows a style sheet with a selector-string that is illegal in CSS1 (P[align]). The parser skips the entire ruleset, reducing the style sheet to the valid rules.
```css
H1 { color: blue }
P[align], UL { color: red; font-size: large }
P EM { font-weight: bold }
```
```css
H1 { color: blue }
P EM { font-weight: bold }
```
--------------------------------
### CSS1 parser skipping invalid declarations
Source: https://www.w3.org/TR/REC-CSS1-961217
Shows a style sheet with declarations that have invalid values or unknown properties. The parser skips these declarations, reducing the style sheet to the valid declarations.
```css
H1 { color: red; font-style: 12pt }
P { color: blue; font-vendor: any; font-variant: small-caps }
EM EM { font-style: normal }
```
```css
H1 { color: red; }
P { color: blue; font-variant: small-caps }
EM EM { font-style: normal }
```
--------------------------------
### Set right margin with percentage (margin-right)
Source: https://www.w3.org/TR/REC-CSS1-961217
Sets the right margin of an element to 12.3% of the parent element's width. Negative values are allowed but may have implementation-specific limits.
```css
H1 { margin-right: 12.3% }
```
--------------------------------
### CSS font set for multilingual text
Source: https://www.w3.org/TR/REC-CSS1-961217
Defines a font-family list for text containing Latin, Japanese, and mathematical symbols. The browser tries each font in order to find a glyph for a character.
```css
BODY { font-family: Baskerville, Mincho, Symbol, serif }
```
--------------------------------
### Clear floating elements with CSS 'clear' property
Source: https://www.w3.org/TR/REC-CSS1-961217
Moves H1 elements below any floating element on the left side, preventing floating elements from appearing on that side.
```css
H1 { clear: left }
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.