W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > January to March 2019

Re: Code in Pre should not be a failure at this time.

From: Wayne Dick <wayneedick@gmail.com>
Date: Sat, 2 Feb 2019 14:45:37 -0800
Message-ID: <CAJeQ8SDHDCjX+-mkz4pfPh+AtSrWv8TCBM5PF0yuRx2KK18DCA@mail.gmail.com>
To: "Patrick H. Lauke" <redux@splintered.co.uk>
Cc: GLWAI Guidelines WG org <w3c-wai-gl@w3.org>
The following code gives code that word wraps and preserves indentation up
320 CSS pixels. It really needs media queries for best results but I left
them out for brevity. It is long anyway. This is my ideal of accessible
output.

Best, Wayne

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Reflow Code</title>
<style>
 .code1 { display: grid;
   background: #FCC;
   padding: 0;
   grid-template-rows: 1fr;
   grid-template-columns: 0.25fr 1.75fr 70fr;}
 .code2 {display: grid;
   background: #FCC;
   padding: 0;
   grid-template-rows: 1fr;
   grid-template-columns: 0.25fr 3.75fr 68fr;}
 .code3 { display: grid;
   background: #FCC;
   padding: 0;
   grid-template-rows: 1fr;
   grid-template-columns: 0.25fr 5.75fr 66fr;}
</style>
</head>
<body>
<p>This grid example was modified from Eric Meyer <em>Grid Layout in CSS,
Figure 1.4</em></p>
<p class = "code1">001<span></span>for (var i =0; i < sLst.length; i++)
{str+=sheet(sLst[i]);}
</p >
<p class="code2">002<span></span>if (i < sLst.length-1) {</p>
<p class="code3">003<span></span>// recursive case inserts comma
separator</p>
<p class="code3">004<span></span>str+=com;</p>
<p class="code3">005<span></span>}</p>
<p class="code2">006<span></span>}</p>
</body>
</html>

On Sat, Feb 2, 2019 at 2:12 PM Wayne Dick <wayneedick@gmail.com> wrote:

> Hi Patrick,
>
> I agree about line numbers but it is a small problem. You can pull a code
> file into almost any word processor. Make the text an ordered list and save
> it to text. You get a line numbered text file of your code. I just did it
> in Google Docs.
>
> Best, Wayne
>
Received on Saturday, 2 February 2019 22:46:35 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 21:08:29 UTC