473,657 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text sizes - use percentages?

Hi all.

I am playing with html and css. I don't (yet) have a working site,
I'm just trying to build a working, basic template I can use for a
couple of ideas I have.

I recall reading a discussion in a newsgroup in the past that came to
the conclusion that the best way to use font sizes with css was to use
percentages. Is that still the case? If so, how does one implement
it?

To use percentages one needs a starting point to work from. How is
this defined?

I have googled for this and found so many conflicting sites, all
showing differing reasoning for reccomending different ideas. But not
one showing a simple idiots guide, so far.

Thanks.

--
Regards from Mike, Jan and Master Alex Barnard.
South Coast, UK.

[To reply by email remove ".trousers" spamtrap from email address]
--
The Source For Premium Newsgroup Access
Great Speed, Great Retention
1 GB/Day for only $8.95
Mar 13 '06 #1
26 2237
On Mon, 13 Mar 2006 17:21:08 +0100, Mike Barnard
<m.************ ****@thunderin. co.uk> wrote:
I recall reading a discussion in a newsgroup in the past that came to
the conclusion that the best way to use font sizes with css was to use
percentages. Is that still the case? If so, how does one implement
it?

To use percentages one needs a starting point to work from. How is
this defined?
If you don't define any length or percentage for font size, it will show
in your browser viewport at what you defined as 100%. And it will show in
my viewport, my browser, as what I defined as 100%. That's the beauty. Our
preferred 100% may be different, but this way we both get what we
want/need.
It also gives you your point of reference. The size the viewer has decided
to use for 100% is what is the 100% (or 1em for that matter).

Use this 100% as your starting point, defining it as the font-size for
your body element (if not, IE may get it wrong IIRC). Then use 100% for
the main text, use smaller if you wish for stuff like menu's and copyright
notices, but keep in mind that anything under 85% might be illegable (some
will argue below 90% is a no go area).

Now, if you use em or percentages as a length for the block level elements
that you use to layout your page too, and not set a specific width for the
page as a whole, the whole thing will keep some integrity in design no
matter how it is viewed (within a certain bandwidth).

Everybody wins. Your visitor can actually read what you publish and your
design does not easily fail. Good, eh?
I have googled for this and found so many conflicting sites, all
showing differing reasoning for reccomending different ideas. But not
one showing a simple idiots guide, so far.


Ah, should have googled this group then (or other: ciwa and alt.html.*)
Lots of idiots around here needing eachothers guidance :-)

--
______PretLette rs:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 13 '06 #2
Mike Barnard wrote:

I recall reading a discussion in a newsgroup in the past that came to
the conclusion that the best way to use font sizes with css was to use
percentages. Is that still the case? If so, how does one implement
it?
Since IE has not changed in 6 years, yes, that is still the case.
For example: body { font-size: 100%; }
To use percentages one needs a starting point to work from. How is
this defined?

The browser sets the default text size, usually it is 16 pixels. IE
offers no explicit way to set it, only larger/smaller text size options.
Other browsers allow the user to pick any size they want.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Mar 13 '06 #3
To use percentages one needs a starting point to work from. How is
this defined?


Dan Cederholm's method in the book "Bullet Proof Web Design" is to set
the body to font-size: small, and go from there. The coding below is
that plus a hack to make IE5 the same size as other browsers. Small is
very comparable to 12px. One thing to remember: Nested percentages
compound (ie: if you set an element to 80%, and the parent to 90%, then
the element will actually be 72%).

body {
font-size: x-small; /* for IE5/Win */
voice-family: "\"}\"";
voice-family: inherit;
font-size: small; /* for compliant browsers */
}
html>body { /* be nice to Opera */
font-size: small;
}

Mar 13 '06 #4
josh wrote:
To use percentages one needs a starting point to work from. How is
this defined?

Dan Cederholm's method in the book "Bullet Proof Web Design" is to set
the body to font-size: small, and go from there.


In other words, he thinks the default size in which text should appear
in my browser is smaller than what I've set as my default size. He
should think again.
Mar 13 '06 #5
On Mon, 13 Mar 2006 18:42:39 +0100, josh <jo**********@y ahoo.com> wrote:
To use percentages one needs a starting point to work from. How is
this defined?


Dan Cederholm's method in the book "Bullet Proof Web Design" is to set
the body to font-size: small, and go from there.


If that is true, rip those pages out of your book and forget about Dan
Cederholm as far as this topic is concerned. Looking at
<URL:http://www.alistapart. com/articles/mountaintop/> for example, gives
me a page that I cannot read comfortably without adjusting font size to
140% and setting the page width to fit in the width of my viewport (725px
wide at the moment). It is a horrific design as far as accessibility and
usability are concerned. All IMO of course.

--
______PretLette rs:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 13 '06 #6
On Mon, 13 Mar 2006, Barbara de Zoete wrote:
On Mon, 13 Mar 2006 18:42:39 +0100, josh <jo**********@y ahoo.com>
wrote:
Dan Cederholm's method in the book "Bullet Proof Web Design" is to
set the body to font-size: small, and go from there.
If that is true, rip those pages out of your book and forget about
Dan Cederholm as far as this topic is concerned.


Absolutely! (or was that the wrong choice of word :-{ )
Looking at
<URL:http://www.alistapart. com/articles/mountaintop/> for example,
Aaaargh, microfonts...
gives me a page that I cannot read comfortably without adjusting
font size to 140% and setting the page width to fit in the width of
my viewport (725px wide at the moment).
Mozilla has a min. font size setting, which works great if one really
wants to read what these idiots publish. I have to remember to turn
it off (thanks to Pederick's web developer toolbar) when I'm asked to
review a page.

But this particular page not only uses microfonts (as measured against
*my* choice of scale), but also refuses to fit in my chosen browser
window. So, *out of the window* it can go...
It is a horrific design as far as accessibility and usability are
concerned.
Indeed. Surely the phrase "bullet proof" was a give-away? Just like
all those "bullet-proof mail hosting" offers, their only concern is to
impose their own will - no matter what the needs or desires of the
recipients might be.
All IMO of course.


No, not "all". Some of these facts are objective.

tot ziens

--

Nothing good has ever come of putting physicists and computer people in
the same room. - Joseph DeMartino (seen on a.h.b-o-u)
Mar 13 '06 #7
I was just throwing out a way to do it. How about another?

Do you guys advocate not setting font sizes at all? That was the
impression I got from some of the responses.

I should also note that Cederholm doesn't advocate making the font-size
really small, just to use a keyword as a starting base, and to adjust
IE because it is different from most browsers. Also the website that
someone posted and critisized isn't even a site of Cederholm's, but
rather an article he authored.

Mar 13 '06 #8
On Mon, 13 Mar 2006 17:35:36 +0100, "Barbara de Zoete"
<tr******@pretl etters.net> wrote:
Use this 100% as your starting point, defining it as the font-size for
your body element (if not, IE may get it wrong IIRC). Then use 100% for
the main text, use smaller if you wish for stuff like menu's and copyright
notices, but keep in mind that anything under 85% might be illegable (some
will argue below 90% is a no go area).


I had a problem with Opera when the body font-size was 100%. Elements
with font-size 100% were shown in a smaller font. Setting body
font-size to 100.1% fixed the problem.

--
Steven
Mar 13 '06 #9
josh wrote:
I was just throwing out a way to do it. How about another?

Do you guys advocate not setting font sizes at all? That was the
impression I got from some of the responses.

I should also note that Cederholm doesn't advocate making the font-size
really small, just to use a keyword as a starting base, and to adjust
IE because it is different from most browsers.


That right there is a bad perspective. An IE user has IE set the way he
likes it. A Firefox user has Firefox set the way he likes it. A CSS
font-size of 100% for the body is 100% of that on either browser. The
Firefox user doesn't care how the page would look in IE, or vice versa.
Mar 13 '06 #10

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

Similar topics

9
2360
by: Billy | last post by:
Hi, I was wondering if it is possible to change the browsers text settings. ie. in internet explorer you can change the text size by going to: View -> Text Size Is there a way to overide a browsers settings so that no matter who loads my page it will be the same regardless of their settings? Thanks, Billy
3
7098
by: Marti | last post by:
Dear everyone, Its my understanding that IE6 now uses a default text-size of "Small" rather than IE5's "Medium". Since I have used relative font-sizes (usually in ems) on all my sites, I am now getting reports of "your fonts are too tiny" from various users. Of course, the sites still look fine if those users set their text-size to medium, but face it -- most people don't even know thats an option.
8
1702
by: Cool Guy | last post by:
I'm converting my table-layout style HTML site to a mainly CSS one and have run into a little problem with IE. Here is a demonstration screenshot of the problem: http://tomjb.com/misc/problem.png Basically, when the text in my 'div' wraps around, it goes too far left in IE. This doesn't happen in Firefox.
4
3403
by: frogman042 | last post by:
My daughter is playing around trying to learn JavaScript and she wrote a small program that prints out a message in increasing and decreasing font size and color changes. She is using document write and it works fine until she puts it into a function and then calls the function from a button with onClick. This also seems to work OK, with the exception that the page is cleared, and the curser changes (and stays) as an hourglass. In...
12
2405
by: one man army | last post by:
New to this, good programmer, picking up some js I wanted to set a line of text as text BOLD more text BOLD text BOLD I can set the text in javascript in a single <div>, but I tried this <div id="divResText1_id" style=" font-family: Arial,sans-serif; text-align: center; font-size: 14px;"> The search returned </div> <div id="divResTextCnt_id" style=" font-size: 20px; font-weight:bold;">
7
2297
by: Rich | last post by:
Is the link rel="stylesheet" supposed to be real plain text, or would some word processor format such as Word/Pad work? This sample stylesheet seems garbled if downloaded and opened with Notepad, but seems to view right in browser. Could this be a problem, or cause slow loading when applied? A link for this sample "style.css" is on http://users.ntplx.net/~richw/ Thanks for any advice, Rich
10
2865
by: Cerebral Believer | last post by:
Hi all, I am keen to allow people who view my site to be able to resize the text in their browsers (especially for people who need to read larger text). With my old web-page I specified the point size in the HTML code, and noticed that when using Internet Explorer the text could not be resized. In designing my new site I have chosen to express the text sizes as percentages in a stylesheet, e.g. ..side_panel_title {
15
3850
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px; margin-left: -400px; width: 800px; height: 26px"> <!-- CODE GOES HERE --> </div>
60
4757
by: deko | last post by:
As I understand it, most browser manufacturers have agreed on 16px for their default font size. So, this should be an accurate conversion for percentages: px % 16 = 100 14 = 87.5 13 = 81.25
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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
8603
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
7320
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
2726
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
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
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.