473,372 Members | 853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

font-size in <table> is not herited from <body> ?

PYG
Hi everybody

I have a simple question :

If i use this code :
<body style="font-size:24px;color:blue;">
Text in body
<table>
<tr><td>
Text in table
</td></tr>
</table>
</body>

I define a body style with 24px font size and blue color

The text in the body appears with these attributes : fine !
When i use a table inside the body, the text in the table is blue (cascading
style from body : OK), but the font size is not 24px (reset to default size
i think).

So my question is : Why does the attribute font-size is not propagated to
the text in the table and how can i do that without adding a new font-size
style in the table itself ?

Many thank for any answer.

Jun 27 '08 #1
3 5714
In article <48***********************@news.free.fr>,
"PYG" <py*@NOSPAM-advi.frwrote:
Hi everybody

I have a simple question :

If i use this code :
<body style="font-size:24px;color:blue;">
Text in body
<table>
<tr><td>
Text in table
</td></tr>
</table>
</body>

I define a body style with 24px font size and blue color

The text in the body appears with these attributes : fine !
When i use a table inside the body, the text in the table is blue (cascading
style from body : OK), but the font size is not 24px (reset to default size
i think).

So my question is : Why does the attribute font-size is not propagated to
the text in the table and how can i do that without adding a new font-size
style in the table itself ?

Many thank for any answer.
Try a proper doctype (this one does not allow loose text in body, but
this has nothing to do with your problem):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>gaps"</title>
<style type="text/css" media="screen">
</style>
</head>
</html>
<body style="font-size:50px;color:blue;">
<p>Text in body</p>
<table>
<tr><td>
Text in table
</td></tr>
</table>
</body>

I cannot say for sure about WinIE.

Btw, best not to use px for font-size. Google for why or look up the
archives of this group.

--
dorayme
Jun 27 '08 #2
On Jun 6, 10:29*am, "PYG" <p...@NOSPAM-advi.frwrote:
>
If i use this code :
A URL is more useful than a code snippet. As I explain below the
reason for your problem is to do with a different part of the page.
<body style="font-size:24px;color:blue;">
Text in body
<table>
<tr><td>
Text in table
</td></tr>
</table>
*</body>

I define a body style with 24px font size and blue color
Which, by the by, is a bad idea. Pixels are not the most suitable unit
for font sizes on the web and setting a colour without also setting a
background colour can cause problems when the user has a default
background of, for example, blue.
The text in the body appears with these attributes : fine !
When i use a table inside the body, the text in the table is blue (cascading
style from body : OK), but the font size is not 24px (reset to default size
i think).

So my question is : Why does the attribute font-size is not propagated to
the text in the table and how can i do that without adding a new font-size
style in the table itself ?
The answer depends on the rest of the page.

Back in the old days of <fonttags the font size was not inherited
into tables. When CSS support was first added to browsers it was made
backwards compatible with <fonttags and so the font size was not
inherited into tables. This has been fixed in newer browsers, but they
still maintain a backwards compatability option, usually known as
"quirks mode". The browser decides to use quirks mode or standards
mode depending on the doctype, or lack of, on the page. Google for
"doctype switching".

Steve
Jun 27 '08 #3
PYG

I used this doctype :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I repaced it by this one :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

And it wordks fine !!

Many thanks

"dorayme" <do************@optusnet.com.aua crit dans le message de news:
do**********************************...ptusnet.com.au...
In article <48***********************@news.free.fr>,
"PYG" <py*@NOSPAM-advi.frwrote:
>Hi everybody

I have a simple question :

If i use this code :
<body style="font-size:24px;color:blue;">
Text in body
<table>
<tr><td>
Text in table
</td></tr>
</table>
</body>

I define a body style with 24px font size and blue color

The text in the body appears with these attributes : fine !
When i use a table inside the body, the text in the table is blue
(cascading
style from body : OK), but the font size is not 24px (reset to default
size
i think).

So my question is : Why does the attribute font-size is not propagated to
the text in the table and how can i do that without adding a new
font-size
style in the table itself ?

Many thank for any answer.

Try a proper doctype (this one does not allow loose text in body, but
this has nothing to do with your problem):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>gaps"</title>
<style type="text/css" media="screen">
</style>
</head>
</html>
<body style="font-size:50px;color:blue;">
<p>Text in body</p>
<table>
<tr><td>
Text in table
</td></tr>
</table>
</body>

I cannot say for sure about WinIE.

Btw, best not to use px for font-size. Google for why or look up the
archives of this group.

--
dorayme

Jun 27 '08 #4

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

Similar topics

7
by: GaryDean | last post by:
In my old 1.1 apps the default was MS_POSITIONING="GridLayout" and Textboxes and labels and such always had POSITION: absolute; and I never had any distortion when the page was rendered. Life was...
4
by: poojak | last post by:
I have write two different js function in a external file. one function write a table (I used innerHTML for this.) and another function is for showing/ hideing some rows depending on radio button...
4
Fary4u
by: Fary4u | last post by:
Hi for the last few months i've just stuck in 1 error & i don't know how to figer it out could any body find out where is the problem gonna be ? it's working fine but when u add product into...
2
by: MOS1 | last post by:
Folks Please help this is driving me insane The + expands but the minus fails Error src is null or not an object function Win_onLoad() { GetNameAndLink(0); } function GetNameAndLink(pkId)
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
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,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
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...
0
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...

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.