12 replies [Last post]
samangh1
samangh1's picture
Offline
newbie
Last seen: 11 years 50 weeks ago
Timezone: GMT-7
Joined: 2010-10-17
Posts: 2
Points: 3

Hey guys,

If I set the body font-size to 15px how big will be my h1 tag?
h1 is 32px, but I don't know how it inheritance it from parent which has px value.

By the way I found that if I set body font-size to 84% through 88% the h1 tag will not inherit correctly. Anybody knows whats going on?

Thanks.

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 3 weeks 4 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2053
Points: 2285

What browser are you talking

What browser are you talking about? Are you using a complete doctype? Show your code and you may as well validate it in the meanwhile.

samangh1
samangh1's picture
Offline
newbie
Last seen: 11 years 50 weeks ago
Timezone: GMT-7
Joined: 2010-10-17
Posts: 2
Points: 3

Here's my code

IE

Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>font sizing</title>
<style type="text/css">
<!--
 
body {
	color: #000000;
	padding: 0;
	margin: 0;
	font-family: Arial, Helvetica, sans-serif;
	text-align:center;
	font-size: 85%;
}
 
h1{ font-size: 27.20px;
 
}
 
p {  font-size: 13.6px;
}
 
 
 
-->
</style>
</head>
 
<body>
<h1>This Is h1</h1>
<p>Font-size works with the main text as I remove font-size: 13.6px; text size won't change, but for h1 it gets tricky. I set body font-size to 85% which should calculate for h1 tag like this: .85 * 32 = 27.20px, but if I set the 27.2px for font-size the h1 will get bigger which should stay the same.</p>
 
</body>
 
 
</html>

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 3 weeks 4 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2053
Points: 2285

How big is ...

How big is .2px and .6px?

More importantly, why are you defining your font sizes in px?

Which version of IE is troublesome?

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 year 33 weeks ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Verschwindende wrote: How big

Verschwindende wrote:

How big is .2px and .6px?

How cold is fifty degrees below absolute zero?

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Vade
Vade's picture
Offline
Enthusiast
Ireland
Last seen: 11 years 44 weeks ago
Ireland
Joined: 2007-08-13
Posts: 315
Points: 276

Ed Seedhouse

Ed Seedhouse wrote:

How cold is fifty degrees below absolute zero?

Should be something like −323.15°C or −581.67°F. Tongue

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 year 33 weeks ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Vade wrote: Ed Seedhouse

Vade wrote:
Ed Seedhouse wrote:

How cold is fifty degrees below absolute zero?

Should be something like −323.15°C or −581.67°F. Tongue

Well, no. Absolute zero is as low as the temperature can get. Lower temperatures don't exist, just as 0.6 of a pixel doesn't on a computer screen. That was the point of the question.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 51 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Ed Seedhouse wrote: Lower

Ed Seedhouse wrote:

Lower temperatures don't exist, just as 0.6 of a pixel doesn't on a computer screen.

Incorrect. Some browsers do allow fraction increments for certain properties, e.g. try font-size or letter-spacing in Firefox: for every .1px increase you can see the text increase in size or spacing.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 3 weeks 4 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2053
Points: 2285

Tyssen wrote: ... Incorrect.

Tyssen wrote:

... Incorrect. Some browsers do allow fraction increments for certain properties. ...

Is IE one of them? If not, that would sort of, kinda, maybe answer this thread.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 51 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Couldn't tell you. I don't

Couldn't tell you. I don't bother fine tuning in IE enough to have tried it.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 year 33 weeks ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Tyssen wrote: Ed Seedhouse

Tyssen wrote:
Ed Seedhouse wrote:

Lower temperatures don't exist, just as 0.6 of a pixel doesn't on a computer screen.

Incorrect. Some browsers do allow fraction increments for certain properties, e.g. try font-size or letter-spacing in Firefox: for every .1px increase you can see the text increase in size or spacing.

But there is no screen object less than 1 pixel in size nevertheless.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 51 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Ed Seedhouse wrote: But there

Ed Seedhouse wrote:

But there is no screen object less than 1 pixel in size nevertheless.

Whether there is or not is not the point. We're talking about CSS and how browsers display fractional font-sizes set in pixels and it's established that browsers have to deal with sub-pixel layout problems:

http://ejohn.org/blog/sub-pixel-problems-in-css/
http://weblogs.mozillazine.org/roc/archives/2008/01/subpixel_layout.html
http://css3wizardry.com/2010/10/05/subpixel-rendering-2/

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 51 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Verschwindende wrote: Tyssen

Verschwindende wrote:
Tyssen wrote:

... Incorrect. Some browsers do allow fraction increments for certain properties. ...

Is IE one of them?

As of IE9 it will be: http://blogs.msdn.com/b/ie/archive/2010/11/03/sub-pixel-fonts-in-ie9.aspx

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference