Re: [WSG] Style PRE with word wrap?

2005-06-01 Thread Vaska . WSG
It's a pretty solution, but it doesn't word-wrap...at least not in Safari. Make your browser window thinner and see what happens? What I'm doing is no different except that I'm going through the trouble of having php count the number of tabs and then using that information to insert the

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Prabhath Sirisena
I'm trying to make a page that will display some source code. The PRE tag works very will with retaining \t and \n but I can not find a way to make it wrap words. Words fly off the monitor... Shouldn't you be using the code tag instead? It's a semantically better option. However, the

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Ben Ward
Prabhath - code is an inline element, so while is should probably be included somewhere in marking up code, you need something else on the outside of it to create the block. pre is semantically pretty sound for this, since code is pre-formatted and some languages are white-space sensitive, for

RE: [WSG] Style PRE with word wrap?

2005-05-31 Thread Patrick Lauke
Ben Ward pre is semantically pretty sound for this, since code is pre-formatted and some languages are white-space sensitive, for example. To split hairs, though, the problem with pre seems to be that it appears very much like a presentational, rather than a semantic element. Any semantics

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Prabhath Sirisena
I would do it this way: code class=codeblock int foo (int a, int b) { br / /* do stuff here */ br / } br / /code And use the css: code.codeblock { display: block; } Is this OK, or do you find anything unacceptably wrong here? Looks better than a PRE to me. Prabhath http://nidahas.com

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Ben Ward
Fair point, pre was indented purely for presentation. However, it does have a small bit of semantic significance, insofaras it says whitespace is important. Sure, it indents that in terms of presentation but the implied meaning is not irrelevent (especially in the context of languages where the

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Ben
On 5/31/05, Prabhath Sirisena [EMAIL PROTECTED] wrote: I would do it this way:code class=codeblockint foo (int a, int b) { br //* do stuff here */ br /} br //codeAnd use the css:code.codeblock {display: block;}Is this OK, or do you find anything unacceptably wrong here? Looksbetter than a PRE to

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread designer
- Original Message - From: Patrick Lauke [EMAIL PROTECTED] To split hairs, though, the problem with pre seems to be that it appears very much like a presentational, rather than a semantic element. Any semantics seem to be inferred by the fact that the content is preformatted, which is a

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Ben
After some testing, I think it's best to stick to using pre for blocks of code. code won't preserve whitespace, so your code's not going to have any indenting unless you use a lot of non-breaking spaces which will inflate the size of your file and not to mention a real be a pain in the butt to

RE: [WSG] Style PRE with word wrap?

2005-05-31 Thread Patrick Lauke
designer Surely, the fact that pre denotes 'preformatting' means that the formatting has occurred 'somewhere else' and not in the body of the html. So, in that sense, in what way is pre 'presentational' any more than all CSS is 'presentational? Aeh...I'm not quite following your

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Vaska . WSG
Thanks for the discussion folks... Actually, because I can't really find a way to get by on the word-wrap issue and also the use of indents (as they appear in the code) I've done all of this in php without code or pre. It uses nbsp;'s for the tabs (preg_replace(/\t/...). Aside from

RE: [WSG] Style PRE with word wrap?

2005-05-31 Thread Patrick Lauke
Vaska.WSG I've done all of this in php without code or pre. CODE is still the semantically correct element to wrap around this type of content, though... What I'm doing is meant purely for presentation...it's a fast way for a person to view a script and try to determine where a bug

RE: [WSG] Style PRE with word wrap?

2005-05-31 Thread Martin J. Lambert
From: Ben After some testing, I think it's best to stick to using pre for blocks of code. code won't preserve whitespace, so your code's not going to have any indenting unless you use a lot of non-breaking spaces which will inflate the size of your file and not to mention a real be a pain

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Ingo Chao
Vaska.WSG schrieb: Actually, because I can't really find a way to get by on the word-wrap issue and also the use of indents (as they appear in the code) I've done all of this in php without code or pre. It uses nbsp;'s for the tabs (preg_replace(/\t/...). ... If you are curious this is

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Vaska . WSG
I think this will do the trick. It's a little odd, and I'll have to test this out more, doing a preg_match_all to determine how many \t's there are (so we know what class='tab$number' to use), but I think in most instances this will suffice. Thanks for pointing this solution out...v On

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread designer
Hi Patrick, - Original Message - From: Patrick Lauke [EMAIL PROTECTED] To: wsg@webstandardsgroup.org Sent: Tuesday, May 31, 2005 1:43 PM Subject: RE: [WSG] Style PRE with word wrap? But to reiterate: h1 has semantic connotations - the content it marks up is a heading. pre, on the other

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Lachlan Hardy
Vaska.WSG wrote: I've been reading around (via Google) and I find others with similar problems but no solution. Is there a solution to this? Whenever I present code in a page, I use something similar to the method Simon Willison put forward by in July 2002:

Re: [WSG] Style PRE with word wrap?

2005-05-31 Thread Ben
Ahh, cool. Looks like the white-space property is supported well enough. http://www.westciv.com/style_master/academy/browser_support/element_type.html I'll go back to using code for code blocks then. :) Thanks for pointing out the property, Martin. BenOn 5/31/05, Martin J. Lambert [EMAIL