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

To change automatically the text size

P: n/a
Hi at all,
how can I do to make a css file to change automatically the text size of the
text that is into a table relatively the screen size?

I.E. if the screen is 800 x I want the text size=10pt but if it is 1024 I
want the text size =12 pt.
Thank in advance
Peter
Jul 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On 29/9/04 10:28 am, Peter wrote:
Hi at all,
how can I do to make a css file to change automatically the text size of the
text that is into a table relatively the screen size?

I.E. if the screen is 800 x I want the text size=10pt but if it is 1024 I
want the text size =12 pt.
Thank in advance
Peter


What do you want to do that for?!?

Even if you *do* know what the screen size is, that still doesn't tell you
how large it is. I've got a 17 inch monitor here. At the moment it's set to
1280x1024, but with a click of the mouse I could change that to anywhere
between 640x480 and 1600x1200. But it will still measure 17 inches.

Here's a novel idea: set the text size to 100% and let your visitors choose
a size that suits them.

Meddling about with text sizes in the way you described is not going to
improve your website one tiny bit. Trust me on that.

Phil

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 20 '05 #2

P: n/a
Peter wrote:
how can I do to make a css file to change automatically the text size of the
text that is into a table relatively the screen size? I.E. if the screen is 800 x I want the text size=10pt but if it is 1024 I
want the text size =12 pt.


I don't know where to start.

1) *You* may want the font that size, but what about the user of your
site? He or she may use a larger screen to fit more information on, and
you are undoing their wishes.

pt is a particularly illogical choice for screen display, as it is a
physical measurement (72pt = 1 inch). What does that mean for your fonts
on a 3" PDA screen or a 90" projection screen? How do you even know the
physical size of the viewing area?

Don't set absolute font sizes, but use relative sizing with 100% as the
main content text size. That way, the user gets the font size (s)he wants.

2) Screen width is not the same as browser window width. The user may
want to use a large screen to have multiple windows side by side.

3) Don't use tables for layout.

Having said all of that, there is a great article on a method to adapt
layout to browser window width using Javascript DOM manipulation. This
isn't guaranteed to work all the time on all browsers, but is a nice
enhancement:

http://www.themaninblue.com/writing/...ve/2004/09/21/

I use this on my latest site project:

http://step-by-step.org.uk/

If you reduce the window width below about 700px, the header layout
changes, the menu bar shrinks and the text in the table on the
"Prospectus" page shrinks.

Use with care and thought. Modifying font sizes can cause real
accessibility issues.

--
Mark.
http://tranchant.plus.com/
Jul 20 '05 #3

P: n/a
On Wed, 29 Sep 2004 09:28:36 GMT, Peter wrote:
I.E. if the screen is 800 x I want the text size=10pt


If it is your browser, set font size at 100% and use
the 'text zoom' feature to increase size. ..And if
it is *my* browser, don't presume I have it full screen.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 20 '05 #4

P: n/a
"Peter" <NO****@libero.it> wrote:
Hi at all,
how can I do to make a css file to change automatically the text size of the
text that is into a table relatively the screen size?

I.E. if the screen is 800 x I want the text size=10pt but if it is 1024 I
want the text size =12 pt.


That's why you should use font-size: 100% and let the user decide what
his actual font size should be.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #5

P: n/a
Peter <NO****@libero.it>:

I.E. if the screen is 800 x I want the text size=10pt but if it is 1024 I
want the text size =12 pt.


In your Opera 7 user stylesheet:

body {font-size: 100%}
@media screen and (min-width: 800px) {
body {font-size: 10pt}
}
@media projection, screen and (min-width: 1024px) {
/*Note, that the width requirement only applies to 'screen' here.*/
body {font-size: 12pt}
}

See <http://www.w3.org/TR/css3-mediaqueries/#width>.
There's also 'min-device-width' and 'max-device-width', if you really
meant them and not the viewport-width.

Don't use this on the author side in the WWW, except when you exactly know
what you are doing! You, Peter, are obviously not (yet) that experienced.

--
Useless Fact #12:
The national anthem of Greece has 158 verses.
Jul 20 '05 #6

P: n/a
Philip Ronan wrote:
Here's a novel idea: set the text size to 100% and let your visitors choose
a size that suits them.


I have used a browser that thinks 100% means the
full width of the screen, no matter what the browser
window size is. (It was either Opera or Netscape,
about four years ago.)
--
Wes Groleau

Measure with a micrometer, mark with chalk, and cut with an axe.
Jul 20 '05 #7

P: n/a

"Wes Groleau" <gr**********@freeshell.org> wrote in message
news:3L********************@gbronline.com...
Philip Ronan wrote:
Here's a novel idea: set the text size to 100% and let your visitors choose a size that suits them.


I have used a browser that thinks 100% means the
full width of the screen, no matter what the browser
window size is. (It was either Opera or Netscape,
about four years ago.)


What happened years ago on old, buggy browsers doesn't really weigh very
high in comparison with good design practices.

Jul 20 '05 #8

P: n/a
Wes Groleau <gr**********@freeshell.org>:
Philip Ronan wrote:
set the text size to 100%
I have used a browser that thinks 100% means the
full width of the screen, no matter what the browser
window size is.


Maybe for box dimensions, but certainly (I hope) not for font-sizes or
line-heights.
(It was either Opera or Netscape, about four years ago.)


I'm *very* sure it was not Opera and not one of the later NS4s (4.5+).

--
"If you can't convince them, confuse them."
Harry S. Truman
Jul 20 '05 #9

P: n/a
Christoph Paeper wrote:
Wes Groleau <gr**********@freeshell.org>:
Philip Ronan wrote:
set the text size to 100%


I have used a browser that thinks 100% means the
full width of the screen, no matter what the browser
window size is.


Maybe for box dimensions, but certainly (I hope) not for font-sizes or
line-heights.


oops, that's really a bad case of tunnel vision!
(It was either Opera or Netscape, about four years ago.)


I dug around in my mental files and recalled that
it was some version of Opera, and it was only on
tables--body text correctly fit the window.

--
Wes Groleau

Those who make peaceful revolution impossible
will make violent revolution inevitable.
-- John F. Kennedy
Jul 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.