By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

How to say "use the user's INPUT font"?

P: n/a
Is there an HTML (or CSS) way to say "use the user's INPUT font,
whatever that might be."?

Most browsers have the ability for the user to pick his or her own
preference for what font to use inside of <INPUTtags. My question
is, is there a way in HTML or StyleSheet language to say something like
this:
<h4>Here are some values - some are hardcoded, and others are input
feilds:</h4>
<FONT face="same as user's input font preference" size="same as user's
input font preference">
Value 1
</FONT>
<p>
<INPUT type="text" value="Value 2">
<p>
<FONT face="same as user's input font preference" size="same as user's
input font preference">
Value 3
</FONT>
<p>
<INPUT type="text" value="Value 4">
<p>

Essentially, I would like Value 1, Value 2, Value 3, and Value 4 to all
end up being in the same font so they look good together, and have that
font adhere to the user's preferences, NOT mine. (I know I can use
StyleSheets to force my own font preference onto the user for the input
fields, but I'd like to be polite to the user and use the user's
preferences.)

Dec 4 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Ma*****@gmail.com writes:
Is there an HTML (or CSS) way to say "use the user's INPUT font,
whatever that might be."?
Yes - just say nothing at all. What you want is the default behavior if no
<fontelement or CSS is used.
Essentially, I would like Value 1, Value 2, Value 3, and Value 4 to all
end up being in the same font so they look good together, and have that
font adhere to the user's preferences, NOT mine.
An admirable goal. I wish more web authors shared it.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Dec 4 '06 #2

P: n/a
Sherm Pendley <sp******@dot-app.orgwrites:
Ma*****@gmail.com writes:
>Is there an HTML (or CSS) way to say "use the user's INPUT font,
whatever that might be."?

Yes - just say nothing at all. What you want is the default behavior if no
<fontelement or CSS is used.
No, the OP wanted plain body text to be in the font the user has
chosen for <inputelements.

--
Ben.
Dec 4 '06 #3

P: n/a
Ma*****@gmail.com writes:
Is there an HTML (or CSS) way to say "use the user's INPUT font,
whatever that might be."?

Most browsers have the ability for the user to pick his or her own
preference for what font to use inside of <INPUTtags. My question
is, is there a way in HTML or StyleSheet language to say something like
this:
<h4>Here are some values - some are hardcoded, and others are input
feilds:</h4>
<FONT face="same as user's input font preference" size="same as user's
input font preference">
Value 1
</FONT>
<p>
<INPUT type="text" value="Value 2">
<p>
<FONT face="same as user's input font preference" size="same as user's
input font preference">
Value 3
</FONT>
<p>
<INPUT type="text" value="Value 4">
<p>

Essentially, I would like Value 1, Value 2, Value 3, and Value 4 to all
end up being in the same font so they look good together, and have that
font adhere to the user's preferences, NOT mine.
That sounds like an admirable aim, but it may backfire in that you
will *not* be adhering to the user's preference! The user has, most
likely, chosen some other *font* for text that in not in an <input>
control, and your plan will involve ignoring that choice.

That said, if the purpose it to display input controls that have
already been set or the user has no authority to change (and hence the
requirement for a similar look) your best bet is use one but mark it
as read-only.

<input type="text" readonly value="Value 1">
<input type="text" value="Value 2">

--
Ben.
Dec 4 '06 #4

P: n/a

Sherm Pendley wrote:
Ma*****@gmail.com writes:
Is there an HTML (or CSS) way to say "use the user's INPUT font,
whatever that might be."?

Yes - just say nothing at all. What you want is the default behavior if no
<fontelement or CSS is used.
That doesn't do what I'm talking about.
People often pick a different font for the user input fields than they
use for the rest of the page: Often this is so there is a proportional
font for most content, but a fixed-width font for the input fields.

Dec 4 '06 #5

P: n/a
Ben Bacarisse wrote:
That said, if the purpose it to display input controls that have
already been set or the user has no authority to change (and hence the
requirement for a similar look) your best bet is use one but mark it
as read-only.

<input type="text" readonly value="Value 1">
<input type="text" value="Value 2">
That was my first attempt. But when I do that, the browser tends to
make it very hard to read them, by greying it out. I want it to be
very visible and clear without the user needing to sqint.
As for why I want to use the same font - it's becasue there's a grid of
values that looks a little bit spreadsheet-ish, some editable, and some
not editable. They look better and line up nicer when they are a
consistent font.

Dec 4 '06 #6

P: n/a
Ma*****@gmail.com writes:
Ben Bacarisse wrote:
>That said, if the purpose it to display input controls that have
already been set or the user has no authority to change (and hence the
requirement for a similar look) your best bet is use one but mark it
as read-only.

<input type="text" readonly value="Value 1">
<input type="text" value="Value 2">

That was my first attempt. But when I do that, the browser tends to
make it very hard to read them, by greying it out.
Can you post a URL? The elements can be styled. I admit I don't know
how widely supported that is across browsers, but I was able to make
all input controls bold so I can't see why you could not make the
readonly ones have whatever weight and colour you like.

Of course you don't want all distinctions lost since there is a
distinction to be made for the user, but you can choose it yourself:

input { font-weight: bold; }
input[readonly] { border: 0; }

(If you need support in IE<7 you can't use attribute selectors like
that but you will be able to use a class.) This is obviously only one
styling choice out of many.

The big win (if you are indeed authoring for the WWW) is that your
markup says what you mean.

--
Ben.
Dec 4 '06 #7

P: n/a
In article <11**********************@80g2000cwy.googlegroups. com>,
Ma*****@gmail.com wrote:
As for why I want to use the same font - it's becasue there's a grid of
values that looks a little bit spreadsheet-ish, some editable, and some
not editable. They look better and line up nicer when they are a
consistent font.
Am I missing something here? Why don't you just set them all to the same
font?

:
<HEAD>
<STYLE type="text/css">
BODY, INPUT, TEXTAREA { font-family: monospace; }
</STYLE>
</HEAD>
:

--
If you really must contact me by email, visit
http://rumkin.com/tools/compression/base64.php
and decode the following string of characters:
RW1haWw6IHBoaWxyb25hbkBibHVleW9uZGVyLmNvLnVr
Dec 5 '06 #8

P: n/a
Philip Ronan <no****@example.invalidwrites:
In article <11**********************@80g2000cwy.googlegroups. com>,
Ma*****@gmail.com wrote:
>As for why I want to use the same font - it's becasue there's a grid of
values that looks a little bit spreadsheet-ish, some editable, and some
not editable. They look better and line up nicer when they are a
consistent font.

Am I missing something here?
Yes :-)
Why don't you just set them all to the same
font?

:
<HEAD>
<STYLE type="text/css">
BODY, INPUT, TEXTAREA { font-family: monospace; }
</STYLE>
</HEAD>
:
The OP wanted to be able to use the font the user has chosen for INPUT
controls. This may not be the same as monospace.

--
Ben.
Dec 5 '06 #9

P: n/a
Ma*****@gmail.com wrote:
Is there an HTML (or CSS) way to say "use the user's INPUT font,
whatever that might be."?

Most browsers have the ability for the user to pick his or her own
preference for what font to use inside of <INPUTtags.
Where? I've never seen this in IE or Firefox.
My question
is, is there a way in HTML or StyleSheet language to say something like
this:
<h4>Here are some values - some are hardcoded, and others are input
feilds:</h4>
<FONT face="same as user's input font preference" size="same as user's
input font preference">
Value 1
</FONT>
There isn't any way to do this. In IE you might be able to get the
actual font properties being applied in CSS to an actual INPUT field on
the current page using Javascript, and then apply them to other parts of
the page, but that's a mess, it requires Javascript, and it will only
work in IE.
<p>
<INPUT type="text" value="Value 2">
<p>
<FONT face="same as user's input font preference" size="same as user's
input font preference">
Value 3
</FONT>
<p>
<INPUT type="text" value="Value 4">
<p>

Essentially, I would like Value 1, Value 2, Value 3, and Value 4 to all
end up being in the same font so they look good together, and have that
font adhere to the user's preferences, NOT mine.
If the user's preference is to have different fonts in different places,
and had gone out of his way to configure the browser that way, then
making the fonts all the same wouldn't be adhering to the user's
preferences, it would be violating them. Why would you have a better
idea what looks good to the user than the user does?

(I know I can use
StyleSheets to force my own font preference onto the user for the input
fields, but I'd like to be polite to the user and use the user's
preferences.)
Then why do you want to muck around with *any* of his fonts?
Dec 5 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.