Discussion:
Newbie help for CSS rule
(too old to reply)
Rapt0r
2010-02-17 17:20:33 UTC
Permalink
Can anyone please help to understand what it means CSS rule that
makes all text 1.5 times larger than the base font of the system and
colors the text red?

What should i write or any one can help to write few codes here
Confused!!
Nick Theodorakis
2010-02-17 18:29:06 UTC
Permalink
Can anyone please help to understand  what it means CSS rule that
makes all text 1.5 times larger than the base font of the system and
colors the text red?
What should i write or any one can help to write few codes here
Confused!!
Homework?

Well, anyway... To apply these properties to all text in a given
element such as <p>, you may write:

p
{
font-size: 1.5em;
color: red;
background: white;
}

Note: always specify a background color if you choose a foreground
color.

You may also wish to assign properties to a class, e.g.:

.note
{
font-size: 1.5em;
color: red;
background: white;
}

Then ...

<p class="note">Note: always specify a background color if you choose
a foreground color.</p>

... in your html code.

Nick

--
Nick Theodorakis
***@hotmail.com
contact form:
http://theodorakis.net/contact.html
Jukka K. Korpela
2010-02-17 21:52:06 UTC
Permalink
Post by Nick Theodorakis
Can anyone please help to understand what it means CSS rule that
makes all text 1.5 times larger than the base font of the system and
colors the text red?
[...]
Post by Nick Theodorakis
Homework?
Probably. And it seems that even c.i.w.a.s. regulars fail in it. It's
probably not a useful assignment, though, but a clever student can learn
from poor teaching too.
Post by Nick Theodorakis
Well, anyway... To apply these properties to all text in a given
element such as <p>,
Wait a second... the assignment said "all text".
Post by Nick Theodorakis
p
{
font-size: 1.5em;
color: red;
background: white;
}
No, that's not a right answer.
Post by Nick Theodorakis
Note: always specify a background color if you choose a foreground
color.
A good principle indeed, but was in the assignment? I would say that it was
implicit in the assignment that the rule should have the given effects and
only them.

It does not help to replace p with body. It would only set properties for
the body element. Browser style sheets could still set other properties for
other elements, and in fact, they usually do. Typically, elements like code
and pre have reduced font size by default.

It seems that the correct answer is that no single CSS rule suffices. You
would need two rules:

body { font-size: 150% !important; }
* { font-size: 100%; color: red !important; }

Of course, usual CSS caveats still apply. But the above appears to maximize
the odds of achieving the goal that was set. The goal was very absurd in any
normal authoring context, but that's beside the point.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Ed Mullen
2010-02-17 18:35:36 UTC
Permalink
Post by Rapt0r
Can anyone please help to understand what it means CSS rule that
makes all text 1.5 times larger than the base font of the system and
colors the text red?
What should i write or any one can help to write few codes here
Confused!!
<style type="text/css">
body {
font-size: 150%;
</style>
--
Ed Mullen
http://edmullen.net
Why is it that the guy who comes up behind you while you're waiting for
an elevator presses the already-lit button as though he has some magical
powers that you don't?
Beauregard T. Shagnasty
2010-02-17 20:46:05 UTC
Permalink
Post by Ed Mullen
Post by Rapt0r
Can anyone please help to understand what it means CSS rule that
makes all text 1.5 times larger than the base font of the system and
colors the text red?
What should i write or any one can help to write few codes here
Confused!!
<style type="text/css">
body {
font-size: 150%;
color: red;
} <-----------------
Post by Ed Mullen
</style>
Don't forget the color and the closing brace! ;-)

That will do it, Rapt0r, but who wants to read a whole page in "header
format?" In red. Surely, you have a better question.
--
-bts
Ed Mullen
2010-02-18 02:11:09 UTC
Permalink
Post by Nick Theodorakis
Post by Ed Mullen
Post by Rapt0r
Can anyone please help to understand what it means CSS rule that
makes all text 1.5 times larger than the base font of the system and
colors the text red?
What should i write or any one can help to write few codes here
Confused!!
<style type="text/css">
body {
font-size: 150%;
color: red;
}<-----------------
Post by Ed Mullen
</style>
Don't forget the color and the closing brace! ;-)
Yeah, geez, tired eyes ...
--
Ed Mullen
http://edmullen.net
What's another word for thesaurus?
Loading...