css fiddling

This commit is contained in:
Mark Pilgrim
2009-03-13 21:01:59 -04:00
parent bda59cfc55
commit 7ce89fb27b
10 changed files with 48 additions and 47 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
h1:before{content:""}
</style>
</head>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html>Dive Into Python 3</a> <span>&#8227;</span>
<h1>About the book</h1>
<p>The content of <cite>Dive Into Python 3</cite> is licensed under the <a href=http://creativecommons.org/licenses/by-sa/3.0/ rel=license>Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.
+1 -1
View File
@@ -12,7 +12,7 @@ body{counter-reset:h1 20}
</style>
</head>
<p class=skip><a href=#divingin>skip to main content</a>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<form action=http://www.google.com/cse><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#case-study-porting-chardet-to-python-3>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Case study: porting <code>chardet</code> to Python 3</h1>
<blockquote class=q>
+29 -28
View File
@@ -1,61 +1,62 @@
/* typography */
body,.widgets a{font:normal medium 'Gill Sans','Gill Sans MT',Corbel,Helvetica,Jara,'Nimbus Sans L',sans-serif;line-height:1.75;word-spacing:0.1em}
pre,kbd,code,samp{font:normal medium Consolas,'Andale Mono',Monaco,'Liberation Mono','Bitstream Vera Sans Mono','DejaVu Sans Mono',monospace;font-size:medium;line-height:1.75;word-spacing:0}
span,tr + tr th:first-child{font:normal medium 'Arial Unicode MS',FreeSerif,OpenSymbol,'DejaVu Sans',sans-serif}
pre span{font:normal medium 'Arial Unicode MS','DejaVu Sans',FreeSerif,OpenSymbol,sans-serif}
body,.widgets a{font:medium 'Gill Sans','Gill Sans MT',Corbel,Helvetica,Jara,'Nimbus Sans L',sans-serif;line-height:1.75;word-spacing:0.1em}
pre,kbd,code,samp{font-family:Consolas,'Andale Mono',Monaco,'Liberation Mono','Bitstream Vera Sans Mono','DejaVu Sans Mono',monospace;font-size:medium;line-height:1.75;word-spacing:0}
span,tr + tr th:first-child{font:medium 'Arial Unicode MS',FreeSerif,OpenSymbol,'DejaVu Sans',sans-serif}
pre span{font-family:'Arial Unicode MS','DejaVu Sans',FreeSerif,OpenSymbol,sans-serif}
.baa{font:oblique large Constantia,Baskerville,Palatino,'Palatino Linotype','URW Palladio L',serif}
abbr{font-variant:small-caps;letter-spacing:0.1em;text-transform:lowercase}
abbr{font-variant:small-caps;text-transform:lowercase;letter-spacing:0.1em}
.q{margin:auto;text-align:right;font-style:oblique}
.fancy:first-letter{float:left;background:transparent;color:gainsboro;padding:0.11em 4px 0 0;font:normal 4em/0.68 serif}
.q span{font-size:large}
.note{margin-left:4.94em}
.note span{display:block;float:left;font-size:xx-large;line-height:0.875;margin:0 0.22em 0 -1.22em}
.c,pre,.widgets,.widgets a,.download,ins,del,mark{line-height:2.154}
.fancy:first-letter{float:left;color:#ddd;padding:0.11em 4px 0 0;font:normal 4em/0.68 serif}
h1,h2,h3,p,ul,ol{margin:1.75em 0;font-size:medium}
/* basics */
html{background:#fff;color:#000}
body{margin:28px}
#search div{float:right}
li ol{margin:0}
.c{text-align:center;font-size:small;line-height:2.154;margin:2.154em 0}
body{margin:1.75em 28px}
form div{float:right}
.c{text-align:center;margin:2.154em 0}
/* links */
a{background:transparent;text-decoration:none;border-bottom:1px dotted}
a:hover{border-bottom:1px solid}
a:link,.widgets a{color:#1b67c9}
a:visited{color:darkorchid}
a:link,.widgets a{color:#26c}
a:visited{color:#93c}
.skip a,.skip a:hover,.skip a:visited{position:absolute;left:0px;top:-500px;width:1px;height:1px;overflow:hidden}
.skip a:active,.skip a:focus{position:static;width:auto;height:auto}
/* code blocks */
pre{white-space:pre-wrap;padding-left:2.154em;line-height:2.154;border-left:1px solid gainsboro}
pre{white-space:pre-wrap;padding-left:2.154em;border-left:1px solid #ddd}
.widgets{float:left}
.widgets,.widgets a,.download{font-size:small;line-height:2.154}
.block,ol,p,blockquote{clear:left}
pre a,.widgets a{padding:0.4375em 0;border:0}
.c,.widgets,.widgets a,.download{font-size:small}
.block,ol,p,blockquote,h1,h2,h3{clear:left}
pre a,.widgets a{padding:0.4375em 0}
.widgets a{text-decoration:underline}
pre a:hover{border:0}
kbd,mark{font-weight:bold}
.prompt{color:#667}
ins,del,mark{text-decoration:none;font-style:normal;display:inline-block;width:100%;line-height:2.154}
del{background:salmon}
ins{background:palegreen}
mark{background:#ffff80}
ins,del,mark{text-decoration:none;font-style:normal;display:inline-block;width:100%}
del{background:#f87}
ins{background:#9f9}
mark{background:#ff8}
/* tables */
table{width:100%;border-collapse:collapse}
th,td{width:45%;margin:0;padding:0 0.5em;border:1px solid #bbb}
th,td{width:45%;padding:0 0.5em;border:1px solid #bbb}
th{text-align:left;vertical-align:baseline}
td{vertical-align:top}
th:first-child{width:10%;text-align:center}
.simple th{font-family:inherit !important}
.hover{background:#eee;color:inherit;cursor:default}
td pre{margin:0;padding:0;border:0;background:inherit}
.hover{background:#eee;cursor:default}
/* overrides */
th,td,td pre,li ol{margin:0}
td pre{padding:0}
pre a,.widgets a,pre a:hover,td pre{border:0}
/* headers */
h1,h2,h3,p,ul,ol{margin:1.75em 0;font-size:medium}
h1,#noscript{background:papayawhip;width:100%}
h1,h2,h3{clear:both}
body{counter-reset:h1}
h1,#noscript{background:PapayaWhip;width:100%}
h1:before{content:"Chapter " counter(h1) ". "}
h1{counter-reset:h2}
h2:before{counter-increment:h2;content:counter(h1) "." counter(h2) ". "}
+2 -2
View File
@@ -14,7 +14,7 @@ li:last-child:before{content:"A. \00a0 \00a0"}
li.todo{background:white;color:gainsboro}
</style>
</head>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=first><cite>Dive Into Python 3</cite> will cover Python 3 and its differences from Python 2. Compared to the original <cite><a href=http://diveintopython.org/>Dive Into Python</a></cite>, it will be about 50% revised and 50% new material. I will publish drafts online as I go. The final version will be published on paper by Apress. The book will remain online under the <a rel=license href=http://creativecommons.org/licenses/by-sa/3.0/>CC-BY-SA-3.0</a> license.
<p>You can see the <a href=table-of-contents.html>full table of contents</a> (<strong>not finalized</strong>), or read what I&#8217;ve written so far:</p>
<ol start=0>
@@ -41,7 +41,7 @@ li.todo{background:white;color:gainsboro}
<li><a href=case-study-porting-chardet-to-python-3.html>Case study: porting <code>chardet</code> to Python 3</a>
<li><a href=porting-code-to-python-3-with-2to3.html>Porting code to Python 3 with <code>2to3</code></a>
</ol>
<p>There is a <a href=http://hg.diveintopython3.org/>changelog</a>, a <a type=application/atom+xml href=http://hg.diveintopython3.org/atom-log>feed</a>, and <a href=http://www.reddit.com/search?q=%22Dive+Into+Python+3%22&amp;sort=new>discussion on Reddit</a>. During development, you can download the book by cloning the Mercurial repository:
<p>There is a <a href=http://hg.diveintopython3.org/>changelog</a>, a <a type=application/atom+xml href=http://hg.diveintopython3.org/atom-log>feed</a>, and <a href="http://www.reddit.com/search?q=%22Dive+Into+Python+3%22&amp;sort=new">discussion on Reddit</a>. During development, you can download the book by cloning the Mercurial repository:
<pre><samp class=prompt>you@localhost:~$ </samp><kbd>hg clone http://hg.diveintopython3.org/ diveintopython3</kbd></pre>
<p>The final version will be downloadable as <abbr>HTML</abbr> and <abbr>PDF</abbr>.
<p class=c>This site is optimized for Lynx just because fuck you.<br>I&#8217;m told it also looks good in graphical browsers.
+9 -9
View File
@@ -12,7 +12,7 @@ body{counter-reset:h1 2}
</style>
</head>
<p class=skip><a href=#divingin>skip to main content</a>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=root value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=root value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#native-datatypes>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Native datatypes</h1>
<blockquote class=q>
@@ -170,7 +170,7 @@ body{counter-reset:h1 2}
<a><samp class=prompt>>>> </samp><kbd>x * 2</kbd> <span>&#x2462;</span></a>
<samp>Fraction(2, 3)</samp>
<a><samp class=prompt>>>> </samp><kbd>fractions.Fraction(6, 4)</kbd> <span>&#x2463;</span></a>
<samp>Fraction(3, 2)</samp></code></pre>
<samp>Fraction(3, 2)</samp></pre>
<ol>
<li>To start using fractions, import the <code>fractions</code> module.
<li>To define a fraction, create a <code>Fraction</code> object and pass in the numerator and denominator.
@@ -346,7 +346,7 @@ ValueError: list.index(x): x not in list</samp></pre>
<h3 id=lists-in-a-boolean-context>Lists in a boolean context</h3>
<p>You can also use a list in <a href=#booleans>a boolean context</a>, such as an <code>if</code> statement.
<pre class=screen>
<a><samp class=prompt>>>> </samp><kbd>def is_it_true(anything):</kbd> <span>&#x2460;</span></a>
<samp class=prompt>>>> </samp><kbd>def is_it_true(anything):</kbd>
<samp class=prompt>... </samp><kbd> if anything:</kbd>
<samp class=prompt>... </samp><kbd> print("yes, it's true")</kbd>
<samp class=prompt>... </samp><kbd> else:</kbd>
@@ -439,15 +439,15 @@ KeyError: 'db.diveintopython3.org'</samp></pre>
<h3 id=dictionaries-in-a-boolean-context>Dictionaries in a boolean context</h3>
<p>You can also use a list in <a href=#booleans>a boolean context</a>, such as an <code>if</code> statement.
<pre class=screen>
<a><samp class=prompt>>>> </samp><kbd>def is_it_true(anything):</kbd> <span>&#x2460;</span></a>
<samp class=prompt>>>> </samp><kbd>def is_it_true(anything):</kbd>
<samp class=prompt>... </samp><kbd> if anything:</kbd>
<samp class=prompt>... </samp><kbd> print("yes, it's true")</kbd>
<samp class=prompt>... </samp><kbd> else:</kbd>
<samp class=prompt>... </samp><kbd> print("no, it's false")</kbd>
<samp class=prompt>...</samp>
<a><samp class=prompt>>>> </samp><kbd>is_it_true({})</kbd> <span>&#x2461;</span></a>
<a><samp class=prompt>>>> </samp><kbd>is_it_true({})</kbd> <span>&#x2460;</span></a>
<samp>no, it's false</samp>
<a><samp class=prompt>>>> </samp><kbd>is_it_true({'a': 1})</kbd> <span>&#x2462;</span></a>
<a><samp class=prompt>>>> </samp><kbd>is_it_true({'a': 1})</kbd> <span>&#x2461;</span></a>
<samp>yes, it's true</samp></pre>
<ol>
<li>In a boolean context, an empty dictionary is false.
@@ -477,15 +477,15 @@ KeyError: 'db.diveintopython3.org'</samp></pre>
<h3 id=none-in-a-boolean-context><code>None</code> in a boolean context</h3>
<p>In <a href=#booleans>a boolean context</a>, <code>None</code> is false and <code>not None</code> is true.
<pre class=screen>
<a><samp class=prompt>>>> </samp><kbd>def is_it_true(anything):</kbd>
<samp class=prompt>>>> </samp><kbd>def is_it_true(anything):</kbd>
<samp class=prompt>... </samp><kbd> if anything:</kbd>
<samp class=prompt>... </samp><kbd> print("yes, it's true")</kbd>
<samp class=prompt>... </samp><kbd> else:</kbd>
<samp class=prompt>... </samp><kbd> print("no, it's false")</kbd>
<samp class=prompt>...</samp>
<a><samp class=prompt>>>> </samp><kbd>is_it_true(None)</kbd>
<samp class=prompt>>>> </samp><kbd>is_it_true(None)</kbd>
<samp>no, it's false</samp>
<a><samp class=prompt>>>> </samp><kbd>is_it_true(not None)</kbd>
<samp class=prompt>>>> </samp><kbd>is_it_true(not None)</kbd>
<samp>yes, it's true</samp></pre>
<h2 id=furtherreading>Further reading</h2>
<ul>
+1 -1
View File
@@ -14,7 +14,7 @@ h3:before{counter-increment:h3;content:"A." counter(h2) "." counter(h3) ". "}
</style>
</head>
<p class=skip><a href=#divingin>skip to main content</a>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#porting-code-to-python-3-with-2to3>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Porting code to Python 3 with <code>2to3</code></h1>
<blockquote class=q>
+1 -1
View File
@@ -12,7 +12,7 @@ body{counter-reset:h1 4}
</style>
</head>
<p class=skip><a href=#divingin>skip to main content</a>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=root value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=root value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#regular-expressions>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Regular expressions</h1>
<blockquote class=q>
+1 -1
View File
@@ -15,7 +15,7 @@ ul{list-style:none;margin:0;padding:0}
ul li ol{margin:0;padding:0 0 0 2.5em}
</style>
</head>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8><input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> Dive Into Python 3 <span>&#8227;</span>
<h1>Table of contents</h1>
<ol start=0>
+1 -1
View File
@@ -12,7 +12,7 @@ body{counter-reset:h1 7}
</style>
</head>
<p class=skip><a href=#divingin>skip to main content</a>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=root value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=root value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#unit-testing>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Unit testing</h1>
<blockquote class=q>
+2 -2
View File
@@ -12,7 +12,7 @@ body{counter-reset:h1 1}
</style>
</head>
<p class=skip><a href=#divingin>skip to main content</a>
<form action=http://www.google.com/cse id=search><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#your-first-python-program>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Your first Python program</h1>
<blockquote class=q>
@@ -42,8 +42,8 @@ body{counter-reset:h1 1}
<h2 id=divingin>Diving in</h2>
<p class=fancy>Books about programming usually start with a bunch of boring chapters about fundamentals and eventually work up to building something useful. Let's skip all that. Here is a complete, working Python program. It probably makes absolutely no sense to you. Don't worry about that, because you're going to dissect it line by line. But read through it first and see what, if anything, you can make of it.
<p id=noscript>[The code examples will be easier to follow if you enable Javascript, but whatever.]
<p class=download>[<a href=humansize.py>download <code>humansize.py</code></a>]</p>
<p class=skip><a href=#skip-humansize-py>skip over this code listing</a>
<p class=download>[<a href=humansize.py>download <code>humansize.py</code></a>]
<pre><code>SUFFIXES = {1000: ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
1024: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']}