Hi,
I'm using a form with a bunch of input tags to enter numbers. Is there any
way to make the input field right adjusted, so that the numbers align at the
right side instead of the left? Even plain html doesn't work, could java
script or something else help?
Bye
Markus 11 19366
Markus Mueller wrote: I'm using a form with a bunch of input tags to enter numbers. Is there any way to make the input field right adjusted, so that the numbers align at the right side instead of the left? Even plain html doesn't work, could java script or something else help?
Try CSS
<style type="text/css">
@import url(styles.css);
</style>
with the file styles.css containing
input.rightAligned {
text-align: right;
}
and then
<input type="text" class="rightAligned">
--
Martin Honnen http://JavaScript.FAQTs.com/
On Tue, 18 May 2004, Markus Mueller wrote: X-Newsreader: Microsoft Outlook Express 5.50.4927.1200
Please visit <http://piology.org/news/oe-erste-schritte.html>
I'm using a form with a bunch of input tags to enter numbers. Is there any way to make the input field right adjusted, so that the numbers align at the right side instead of the left?
DIR="RTL"
For example <http://www.google.co.il/>
--
Nicht's geht mehr ohne Apostroph.
Martin Honnen wrote: Try CSS <style type="text/css"> @import url(styles.css); </style> with the file styles.css containing input.rightAligned { text-align: right; } and then <input type="text" class="rightAligned">
True, that will often produce the desired effect. However, it is worth
mentioning that, in fact, it should not. According to the CSS2
Specification [1], the /text-align/ property applies only to block-level
elements, which /<input>/ is not. I do not know how or if CSS3 will
address this matter.
[1] http://www.w3.org/TR/REC-CSS2/text.html#alignment-prop
Regards,
--
Ney André de Mello Zunino
Andreas Prilop <nh******@rrzn-user.uni-hannover.de> wrote: I'm using a form with a bunch of input tags to enter numbers. Is there any way to make the input field right adjusted, so that the numbers align at the right side instead of the left?
DIR="RTL"
Isn't that a bit tricky? It's based on the effect that dir="rtl"
implicitly sets align="right", which you could set too but doesn't quite
work (and is obscurely defined) _and_ on the fact that digits have
inherent directionality so that they won't be written right to left.
I'm not that familiar with directionality, and I don't know how well it
has been implemented, but if I try
<input dir="rtl">
and type first "-", then "1", the field contains "1-". Similarly,
"." followed by "1" (meant to mean ".1", i.e. "0.1") produces "1.".
So I would use
<input style="text-align: right; display: block">
together with precautions that deal with the block presentation, as
discussed at http://www.cs.tut.fi/~jkorpela/forms/present.html#align
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
On Tue, 18 May 2004, Jukka K. Korpela wrote: DIR="RTL" Isn't that a bit tricky?
Yes.
So I would use <input style="text-align: right; display: block"> together with precautions that deal with the block presentation, as discussed at http://www.cs.tut.fi/~jkorpela/forms/present.html#align
Agree!
--
Top-posting.
What's the most irritating thing on Usenet?
/Jukka K. Korpela/: So I would use <input style="text-align: right; display: block"> together with precautions that deal with the block presentation, as discussed at http://www.cs.tut.fi/~jkorpela/forms/present.html#align
Why 'display: block'? Isn't the INPUT element already an 'inline-block'?
--
Stanimir
Stanimir Stamenkov <s7****@netscape.net> wrote: Why 'display: block'? Isn't the INPUT element already an 'inline-block'?
Who knows? There is no _normative_ specification of the rendering of
INPUT elements in CSS terms, just a vague "sample style sheet". But
in any case, inline-block is not a CSS 2 concept at all, and the sample
style sheet http://www.w3.org/TR/REC-CSS2/sample.html assigns no display
value to it, hence defaulting to display: inline, which implies that
text-align does not apply. Setting display: block fixes this.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
/Jukka K. Korpela/: Stanimir Stamenkov <s7****@netscape.net> wrote:
Why 'display: block'? Isn't the INPUT element already an 'inline-block'?
Who knows? There is no _normative_ specification of the rendering of INPUT elements in CSS terms, just a vague "sample style sheet". But in any case, inline-block is not a CSS 2 concept at all, and the sample style sheet http://www.w3.org/TR/REC-CSS2/sample.html assigns no display value to it, hence defaulting to display: inline, which implies that text-align does not apply. Setting display: block fixes this.
As you mention, CSS2 doesn't specify how replaced elements are
affected by the style rules, so I don't think setting 'display:
block' fixes anything, really. IIRC the later development on CSS
defines replaced elements as blocks and setting 'display: inline' or
'display: inline-block' on them is effectively the same. But I don't
recall if it is determined how other properties would affect
replaced elements (their content) and every style applied would be
just a wild guess.
--
Stanimir
Stanimir Stamenkov <s7****@netscape.net> wrote: As you mention, CSS2 doesn't specify how replaced elements are affected by the style rules, so I don't think setting 'display: block' fixes anything, really.
So it seems, in practice - IE, Opera, Firefox all right-align the field
content, when I use text-align: right, no matter whether there's
display: block too.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
On Tue, 18 May 2004, Jukka K. Korpela wrote: I'm not that familiar with directionality, and I don't know how well it has been implemented, but if I try <input dir="rtl"> and type first "-", then "1", the field contains "1-".
Internet Explorer, I presume? So this behaviour depends on the browser.
Similarly, "." followed by "1" (meant to mean ".1", i.e. "0.1") produces "1.".
At least one digit _before_ and _after_ the decimal sign is required.
(ISO 31, ISO 1000)
--
Top-posting.
What's the most irritating thing on Usenet?
Andreas Prilop <nh******@rrzn-user.uni-hannover.de> wrote: On Tue, 18 May 2004, Jukka K. Korpela wrote:
I'm not that familiar with directionality, and I don't know how well it has been implemented, but if I try <input dir="rtl"> and type first "-", then "1", the field contains "1-".
Internet Explorer, I presume? So this behaviour depends on the browser.
Yes. I must admit I'm even more confused than before, but surely this
means that dir="rtl" isn't the right way to right align! (Maybe some HTML
zealots would prefer it since it's "pure HTML" and does not need CSS.) Similarly, "." followed by "1" (meant to mean ".1", i.e. "0.1") produces "1.".
At least one digit _before_ and _after_ the decimal sign is required. (ISO 31, ISO 1000)
In some notation systems (which also prefer the decimal _comma_ to
decimal point if I remember correctly), but this is about something that
operates in a situation where we only know that it deals with "numbers"
in an input field. The application might restrict numbers to unsigned
integers, but the behavior would still be surprising and most confusing
to a user who tries to enter numbers by some intuitive (to him) rules.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rosebud |
last post by:
Hello,
I'd like some help trying to generate input fields on the fly. What I
have on an HTML page is a single text input field labelled #1, e.g. #1
<input type="text">. Next to the field is a...
|
by: bengee |
last post by:
Hi
I'm trying to get a <div> displaying at the top of my page containing 2
img's: 1 left aligned and 1 right aligned. I can't get this to work, and
it's driving me up the wall!! Here's the HTML...
|
by: Marek Mand |
last post by:
How to create a functional *flexible* UL-menu list
<div>
<ul>
<li><a href=""></li>
<li><a href=""></li>
<li><a href=""></li>
</ul>
</div>
(working in IE, Mozilla1.6, Opera7 (or maybe even...
|
by: David Lindgren |
last post by:
Hello!
I am using a thirdparty gridcontrol which has a bug in it. It consists of
that when setting a column to be right aligned it doesn't work as it should.
The column gets rightaligned, but...
|
by: GTi |
last post by:
This must be the simplest question on the web.
How can I right align text with DrawString ?
Normal (left aligned):
1234567890
123456789
12345678
1234567
123456
12345
|
by: JB |
last post by:
Hi All,
Why doesn't this work in Firefox but is perfect in IE6?
In IE6, the text is on the same line but in Firefox, the left aligned text
is on the line above the right aligned text.
...
|
by: Yohan Blurp |
last post by:
Hi,
Here is sample page to show you the problem :
<html><body>
<form action="/cgi-bin/test.cgi" method="post">
Data Path : <input type="text" size="50" value="C:\Test Data\May
2007.xls"...
|
by: vulpes |
last post by:
Hi,
I have a horizontal css list and I'd like its last item to be aligned
to the right end
of the space given to the list. I can separate it from the rest with
margin-left: 10em, but that's...
|
by: omar999 |
last post by:
I have a CMS which displays some flight routes, alongside prices, dates which is using asp and sql server 05.
works well - i.e an update on the CMS page populates the sql table and then the asp...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |