non-breaking spaces.

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
User avatar
RSteinwand
Rank VI - Professional
Rank VI - Professional
Posts: 600
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

non-breaking spaces.

Post by RSteinwand » Fri Dec 14, 2018 1:11 pm

Hi Albert,

While converting an existing site that was previously managed by a CMS to static pages, I ran into this gem:

Code: Select all

<li>Print the online form and mail it to: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PO Box 123, City, State</li>
Considering this page was full of single non-breaking spaces between words where an actual space would work, and it had at least 30 of the little buggers, I was surprised to see no notice in CSS. In this case the NBS's were apparently used to break to a new line. It reminded me of word documents where the user would use lots of spaces to center or indent text.

What's your take on this? Do you just count the number and if it's more than you can count on one hand, display a notice about styling with css would be more efficient?

Non-breaking spaces (&nbsp;) should not be used to indent or center text?

Thanks!
Rick

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3407
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: non-breaking spaces.

Post by Albert Wiersch » Sat Dec 15, 2018 12:37 am

Hi Rick,

CSS HTML Validator is more of a technical syntax checker than a bad style checker. It's really difficult to check for bad style (but where it is easy to do so sometimes CSS HTML Validator will generate a message).

My thought is that I wonder how common this actually is (I would think it's rather rare) and if it would be worth generating a "style" message for that would do more good than harm and that wouldn't be confusing.

Have you come across this before? I think it is rather rare....... but what exactly should be the criteria for a style message? Perhaps CSS HTML Validator could count the number of consecutive &nbsp; and space characters and generate a style warning message if the count is at least 3 and &nbsp; has been used 2 or more times?
Image
Albert Wiersch

User avatar
Lou
Rank V - Professional
Rank V - Professional
Posts: 276
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Re: non-breaking spaces.

Post by Lou » Sat Dec 15, 2018 1:01 pm

Like legislating good taste. I don't think there is anything in the standards that would prevent this absurdity.

I don't see that the validator could find/catch/warn all examples of bad style. That would be a rabbit hole that could bloat the validator to something asymptotic to Windows. My 2¢
Lou
Say what you will about Sisyphus. He always has work.

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3407
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: non-breaking spaces.

Post by Albert Wiersch » Sat Dec 15, 2018 1:11 pm

Lou wrote:
Sat Dec 15, 2018 1:01 pm
Like legislating good taste. I don't think there is anything in the standards that would prevent this absurdity.
No... it's more of a "bad style" issue but it might cause accessibility issues if this type of "formatting" is used instead of proper formatting using proper HTML and CSS.
Lou wrote:
Sat Dec 15, 2018 1:01 pm
I don't see that the validator could find/catch/warn all examples of bad style. That would be a rabbit hole that could bloat the validator to something asymptotic to Windows. My 2¢
Yes, there is no way to warn about everything but when it's an issue that isn't too hard to detect and warn about, I don't mind making CSS HTML Validator generate a message about it. A user could always disable the message.
Image
Albert Wiersch

User avatar
RSteinwand
Rank VI - Professional
Rank VI - Professional
Posts: 600
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Re: non-breaking spaces.

Post by RSteinwand » Sat Dec 15, 2018 7:54 pm

Hi Albert,

For the most part, I code everything from scratch so with the except of a typo, most everything is to my standards. In this case, I inherited 500 pages of CMS so coded by people who don't know how to code, so I'm seeing weird stuff. From what I've seen, with the exception of the above snippet, I can search and replace all of it with a space and consider I removed a lot of bloat. Most of what I've seen so far (other pages) has been on either side of a link, which I doubt is really needed. For some reason, this page was full of it. I just mentioned it because I thought it was an easy thing to code and pointed out bad style. It's your call if you want to add it.
Rick

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3407
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: non-breaking spaces.

Post by Albert Wiersch » Sun Dec 16, 2018 9:36 am

Hi Rick,

Thanks for the suggestion. I'll note this on my list but will consider it a low priority item compared to other items on the list. :)
Image
Albert Wiersch

User avatar
RSteinwand
Rank VI - Professional
Rank VI - Professional
Posts: 600
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Re: non-breaking spaces.

Post by RSteinwand » Sun Dec 16, 2018 9:37 am

Thanks Albert!
Rick

Post Reply