473,799 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Alignment to char and other things

[My first post from Google Groups. Hope it's readable.]

I'm working with some semi-advanced tables with lots of decimal
numbers in, and I can't get the alignment to work.

http://www.algonet.se/~gustafl/temp/output_ib.html

I want numbers aligned to the decimal point. The HTML 4 spec says User
agents doesn't need to support 'char' and 'charoff', so I wonder if
the problem is lack of support? If so, can the same results be
achieved in another way?

Next best would be aligning the number to right, but there seem to be
a problem with support for <colgroup> aswell. Am I right? Best
solution I found was to have a class for right alignment and call it
from each <td>.

Also, can someone give me a way to prevent negative numbers to break
after the minus? A solution that adds the least clutter to the code?
Would it be right typographically to replace the minus with an
'endash' (#x2013;)?

Thanks,

Gustaf
Jul 20 '05
30 3526

"Andreas Prilop" <nh******@rrz n-user.uni-hannover.de> wrote in message
news:Pine.GSO.4 .44.04052418453 90.13134-100000@s5b003.. .
On Mon, 24 May 2004, Harlan Messinger wrote:
Prefer decimal character references to hexadecimal references.
Why is that, actually?


Decimal references are better supported among browsers:
<http://ppewww.ph.gla.a c.uk/~flavell/charset/checklist.html>
<http://ppewww.ph.gla.a c.uk/~flavell/charset/quick#cons>
e.g. Netscape 4.x.


Ah. Version 4.77 does understand the hex references, but indeed 4.02
doesn't.
It's certainly easier just to use the codes the way
they appear in the Unicode reference,


Easy reading is hard writing.
_You_ as the author, as a single person convert only once. But your
million readers read a million times (hopefully).


Aw, come on, you gave me a perfectly good reason above. Why did you have to
go and spoil it? Millions of people are going to read the code behind my
page--and I should be concerned with their ability to comprehend it? :-)

Jul 20 '05 #11

"Andreas Prilop" <nh******@rrz n-user.uni-hannover.de> wrote in message
news:Pine.GSO.4 .44.04052418491 40.13134-100000@s5b003.. .
On Mon, 24 May 2004, Harlan Messinger wrote:
Use a fixed width font, [ ... ]

You can also use %nbsp; to replace leading 0's, [ ... ]


You'll find that &nbsp; doesn't have the width of a digit.


It does - in a monospaced font.


Snort--well, *yeah*. :-P

Jul 20 '05 #12
"Harlan Messinger" <h.*********@co mcast.net> wrote:
You'll find that &nbsp; doesn't have the width of a digit.
To be exact, there isn't even any guarantee that digits have equal width.
It just happens that almost (?) all fonts used by browsers have "tabular
digits" that have such a property. In traditional typography, this was
often not the case for digits used in running text - quite conceivably,
"1" was often narrower than "8".

But the space, or the no-break space, does not usually have the same
width as digits, as you say. Using a monospace font solves this problem
but results in a really poor, computerish look.
Unicode has &#x2007; ( ), "figure space", to serve this
purpose. In my IE6, though, this gives a box; in my Firefox it
produces a space that's slightly too wide; and in my Opera it seems
to work just fine.


I don't quite understand the Firefox behavior, but otherwise this is
understandable. Most fonts lack the figure space character, but
e.g. Arial Unicode MS has got it. If you say nothing about fonts on your
page, then your IE probably uses Times New Roman, and most probably some
font that hasn't got the character. Netscape class browsers and Opera
know how to use glyphs from different fonts when needed (which is
sometimes a stylistic problem), though Opera seems to have odd settings
in this respect. In any case, you probably see the Arial Unicode MS
glyph, or maybe a glyph from some less common font.

Consequently, the figure space is not a good solution at present for WWW
pages. It might work well for the purpose of nice alignment in intranets
where everyone has a sufficiently rich font and a sufficiently advanced
browser.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #13

"Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message
news:Xn******** *************** ******@193.229. 0.31...
"Harlan Messinger" <h.*********@co mcast.net> wrote:
You'll find that &nbsp; doesn't have the width of a digit.
To be exact, there isn't even any guarantee that digits have equal width.


Granted, though practically speaking they do in modern fonts--at least, in
my experience, I've always been able to count on it--precisely because
anyone designing a general body font knows perfectly well that people need
them to align!
It just happens that almost (?) all fonts used by browsers have "tabular
digits" that have such a property. In traditional typography, this was
often not the case for digits used in running text - quite conceivably,
"1" was often narrower than "8".

But the space, or the no-break space, does not usually have the same
width as digits, as you say. Using a monospace font solves this problem
but results in a really poor, computerish look.
Unicode has &#x2007; ( ), "figure space", to serve this
purpose. In my IE6, though, this gives a box; in my Firefox it
produces a space that's slightly too wide; and in my Opera it seems
to work just fine.
I don't quite understand the Firefox behavior, but otherwise this is
understandable. Most fonts lack the figure space character, but
e.g. Arial Unicode MS has got it. If you say nothing about fonts on your
page,


I've got font: sans-serif on my test pages.
then your IE probably uses Times New Roman, and most probably some
font that hasn't got the character. Netscape class browsers and Opera
know how to use glyphs from different fonts when needed (which is
sometimes a stylistic problem), though Opera seems to have odd settings
in this respect. In any case, you probably see the Arial Unicode MS
glyph, or maybe a glyph from some less common font.

Consequently, the figure space is not a good solution at present for WWW
pages. It might work well for the purpose of nice alignment in intranets
where everyone has a sufficiently rich font and a sufficiently advanced
browser.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


Jul 20 '05 #14
On Mon, 24 May 2004, Harlan Messinger wrote:
Decimal references are better supported among browsers:
e.g. Netscape 4.x.


Ah. Version 4.77 does understand the hex references, but indeed 4.02
doesn't.


Not only 4.02 but newer versions, too. Support for the hexadecimal form
was introduced somewhere between 4.6 and 4.8.

--
Top-posting.
What's the most irritating thing on Usenet?

Jul 20 '05 #15
On Mon, 24 May 2004, Jukka K. Korpela wrote:
You'll find that &nbsp; doesn't have the width of a digit.


But the space, or the no-break space, does not usually have the same
width as digits, as you say. Using a monospace font solves this problem
but results in a really poor, computerish look.


How about a zero (0) in the same colour as the background? It does not
much harm when displayed black-on-white.

--
Top-posting.
What's the most irritating thing on Usenet?

Jul 20 '05 #16
Andreas Prilop <nh******@rrz n-user.uni-hannover.de> wrote:
But the space, or the no-break space, does not usually have the same
width as digits, as you say. Using a monospace font solves this
problem but results in a really poor, computerish look.


How about a zero (0) in the same colour as the background? It does
not much harm when displayed black-on-white.


A shrewd idea. If you use a program to generate the markup, it's fairly
easy; to write it by hand would be a bit boring, but possible:
<td>123.45<sp an class="sp">00</span></td>
(with .sp { color: white; background: white; }, if your overall
background is white).

There's the risk that people start wondering what's wrong when they see
zeroes or blank depending on the browser and its mode.

For example, they see 123.45 on screen but 123.4500 on paper, maybe with
the digits 00 in gray. This is not serious unless users start thinking
this is a symptom of something serious!

But it seems that using (instead of color setting) just
..sp { visibility: hidden; }
solves the problem both on screen and on print. Maybe even in speech. Or
is there any problem with this approach (apart the usual CSS caveats of
course)?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #17
Jukka K. Korpela wrote:
Andreas Prilop <nh******@rrz n-user.uni-hannover.de> wrote:
But the space, or the no-break space, does not usually have the

same >> width as digits, as you say. Using a monospace font solves
this >> problem but results in a really poor, computerish look.

How about a zero (0) in the same colour as the background? It does
not much harm when displayed black-on-white.


A shrewd idea.


And one that might get you banned in search engines.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #18
On Thu, 27 May 2004, Jukka K. Korpela wrote:
How about a zero (0) in the same colour as the background? It does
not much harm when displayed black-on-white.


<td>123.45<sp an class="sp">00</span></td>
(with .sp { color: white; background: white; }, if your overall
background is white).

For example, they see 123.45 on screen but 123.4500 on paper, maybe with
the digits 00 in gray.

But it seems that using (instead of color setting) just
.sp { visibility: hidden; }
solves the problem both on screen and on print.


The question was about right-aligning of numbers, therefore writing

00123
01234
12345

for example.

--
Top-posting.
What's the most irritating thing on Usenet?

Jul 20 '05 #19
On 27 May 2004, Philipp Lenssen wrote:
How about a zero (0) in the same colour as the background? It does
not much harm when displayed black-on-white.


A shrewd idea.


And one that might get you banned in search engines.


Have you got any evidence?

--
Top-posting.
What's the most irritating thing on Usenet?

Jul 20 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
7791
by: Bhalchandra Thatte | last post by:
I am allocating a block of memory using malloc. I want to use it to store a "header" structure followed by structs in my application. How to calculate the alignment without making any assumption about the most restrictive type on my machine? Thanks.
10
3243
by: j0mbolar | last post by:
for any pointer to T, does a pointer to T have different or can have different alignment requirement than a pointer to pointer to T? if so, where is the exact wording in the standard that would suggest so?
67
10762
by: S.Tobias | last post by:
I would like to check if I understand the following excerpt correctly: 6.2.5#26 (Types): All pointers to structure types shall have the same representation and alignment requirements as each other. All pointers to union types shall have the same representation and alignment requirements as each other. Does it mean that *all* structure (or union) types have the same alignment? Eg. type
13
2999
by: aegis | last post by:
The following was mentioned by Eric Sosman from http://groups.google.com/group/comp.lang.c/msg/b696b28f59b9dac4?dmode=source "The alignment requirement for any type T must be a divisor of sizeof(T). (Proof: In `T array;' both `array' and `array' must be correctly aligned.) Since `sizeof(unsigned char)' is divisible only by one and since one is a divisor of every type's size, every type is suitably aligned for `unsigned char'."
3
2504
by: Bill Pursell | last post by:
I have a program that does most of its work traversing a bunch of lists. The lists contain a void *, and I spent some time today replacing the void *'s with a copy of the data at the end of the structure as a zero length array. The performance improvement that resulted by avoiding the need to dereference the ptr was substantial, but it has left me with an uncertain feeling. In particular, changing an assignment caused the output to...
12
818
by: Yevgen Muntyan | last post by:
Hey, Consider the following code: #include <stdlib.h> #define MAGIC_NUMBER 64 void *my_malloc (size_t n) { char *result = malloc (n + MAGIC_NUMBER);
10
2214
by: haomiao | last post by:
I want to implement a common list that can cantain any type of data, so I declare the list as (briefly) --------------------------------------- struct list { int data_size; int node_num; char nodes; //will be list_node1,list_node2... };
11
2308
by: Brian Gladman | last post by:
A lot of low level cryptographic code and some hardware cryptographic accelerators either fail completely or perform very poorly if their input, output and/or key storage areas in memory are not aligned on specific memory boundaries. Moreover, in many situations the cryptographic code does not itself have control over the memory alignment of its parameters so the best it can do is to detect if these aligmments are correct and act...
1
4340
by: RazvanD | last post by:
Hi! I am trying to get the page-aligned address for an ordinary memory address. As I am using an x86-based CPU the page size is 4KB. Thus, assuming addr is the memory address, I could get the page-aligned address by using the following methods:
8
2831
by: Stephen Horne | last post by:
I understand that the next C++ standard will have features to handle the alignment of data types. This is good, but a bit late for me! I've been using some template trickery to handle alignment issues for some time. What I usually want is a type that takes the same amount of space and has the same alignment as some other type, but which doesn't have constructors, destructors etc. The idea is that initialisation and cleanup can be done...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.