473,320 Members | 1,902 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,320 software developers and data experts.

attention could be a very dumb question

Hi group,

as I was browsing the web and checking out w3schools.com I read that
the font tag was deprecated and that I should use css styles for
formatting like
for example
<p class="p1">
Text goes here
</p>

But I started thinking how would I get for example the next text with
the specified format (between brackets) on my webpage, without having
defining a new <p class="xxx"></p> for every line

<p>
First line (green and bold)
Second line (blue and underline)
Third line (red)
</p>

I warned y'all that this may be a stupid question, but I haven't been
able to keep my html tags update and now I'm trying to update myself
again

Thnx in advance
Jul 23 '05 #1
4 1696
On 31 Aug 2004 06:36:36 -0700, Piedro <pp*****@hotmail.com> wrote:
Hi group,

as I was browsing the web and checking out w3schools.com I read that
the font tag was deprecated and that I should use css styles for
formatting like
for example
<p class="p1">
Text goes here
</p>
Yes, color should be put in the stylesheet.
But I started thinking how would I get for example the next text with
the specified format (between brackets) on my webpage, without having
defining a new <p class="xxx"></p> for every line

<p>
First line (green and bold)
Second line (blue and underline)
Third line (red)
</p>


Well, first, I'm not sure you know, but the above would be rendered like
this.

First line (green and bold)Second line (blue and underline)Third line (red)

If these are separate paragraphs (they're way too short to be paragraphs,
aren't they? Oh well) then use separate p elelemts.

<p>First line (green and bold)</p>
<p>Second line (blue and underline)</p>
<p>Third line (red)</p>

If they are one paragraph with new lines every so often - like a stanza of
a poem, for example - use the br element.

<p>First line (green and bold)<br>
Second line (blue and underline)<br>
Third line (red)</p>

If you want different styles attached to different text, you need to have
different selectors in the stylesheet, and often this means new classes.
Now, here's where a lot of new CSS users get tripped up - use class and id
names which describe the CONTENT, not the EFFECT.

In this case, I'd first decide what is the "usual" rendering of a
paragraph. Let's assume it's plain red text.

p {color: red;}

Now, I can create a class for green and bold. Let's say this is purely
decorateve, I'll call it "deco1" (short for decorative style 1).

..deco1 {color: green; font-weight: bold;}
..deco2 {color: blue; text-decration: underline;}

(BTW I do not recommend underlining and coloring text, unless you really
want people to get mad at you when they click it over and over.)

Now our first example would be:

<p class="deco1">First line (green and bold)</p>
<p class="deco2">Second line (blue and underline)</p>
<p>Third line (red)</p>

The second:

<p><span class="deco1">First line (green and bold)</span><br>
<span class="deco2">Second line (blue and underline)</span><br>
Third line (red)</p>

Hope this clears things up.
Jul 23 '05 #2
Els
Piedro wrote:
Hi group,

as I was browsing the web and checking out w3schools.com I
read that the font tag was deprecated and that I should use
css styles for formatting like
for example
<p class="p1">
Text goes here
</p>

But I started thinking how would I get for example the next
text with the specified format (between brackets) on my
webpage, without having defining a new <p class="xxx"></p>
for every line

<p>
First line (green and bold)
Second line (blue and underline)
Third line (red)
</p>


<p class="threecolor">
<span class="first">First line</span>
<span class="second">Second line</span>
<span class="third">Third line</span>
</p>

CSS:
p.threecolor span.first{color:green;font-weight:bold;}
p.threecolor span.second{color:blue;text-
decoration:underline;}
p.threecolor span.third{color:red;}

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 23 '05 #3
Thnx for al the reply's they where very helpful, but I can't help
feeling a bit dumb because I forgot about the <span></span> tag. But
thnx again for the explanations

Grtz Peter
Els <el*********@tiscali.nl> wrote in message news:<Xn*****************@130.133.1.4>...
Piedro wrote:
Hi group,

as I was browsing the web and checking out w3schools.com I
read that the font tag was deprecated and that I should use
css styles for formatting like
for example
<p class="p1">
Text goes here
</p>

But I started thinking how would I get for example the next
text with the specified format (between brackets) on my
webpage, without having defining a new <p class="xxx"></p>
for every line

<p>
First line (green and bold)
Second line (blue and underline)
Third line (red)
</p>


<p class="threecolor">
<span class="first">First line</span>
<span class="second">Second line</span>
<span class="third">Third line</span>
</p>

CSS:
p.threecolor span.first{color:green;font-weight:bold;}
p.threecolor span.second{color:blue;text-
decoration:underline;}
p.threecolor span.third{color:red;}

Jul 23 '05 #4
pp*****@hotmail.com (Piedro) wrote in news:b7e3650a.0408310536.33f7ef78
@posting.google.com:
Hi group,

Hi
as I was browsing the web and checking out w3schools.com I read that
the font tag was deprecated and that I should use css styles for
formatting like
for example
<p class="p1">
Text goes here
</p>
That is very true.
But I started thinking how would I get for example the next text with
the specified format (between brackets) on my webpage, without having
defining a new <p class="xxx"></p> for every line
<br> is not deprecated.

<p>
First line (green and bold)
Second line (blue and underline)
Third line (red)
</p>

I warned y'all that this may be a stupid question, but I haven't been
able to keep my html tags update and now I'm trying to update myself
again

Thnx in advance


How about just using the deprecated FONT element? They do no harm
(since the alternative is to use long-winded SPAN elements), except for
casuing purists' heads to explode :-), and they are all but universally
supported. Generally, using CSS is an excellent idea. In almost all
cases, that is true. But one-time-use classes are not necessarily a fun
or practical idea.

I would actually use

<p>
<font color="green"><b>First line</b></font><br>
<font color="blue"><u>Second Line</u></font><br>
<font color="red">Third line</font></p>

and I have not used a FONT element in years.

Of course, if you are using this for presentation reasons (especially
ones that would get repeated across pages, you should use cascading
style sheets.
Jul 23 '05 #5

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

Similar topics

16
by: squash | last post by:
a dumb question i had on my mind: Say you have a dynamically created web page . Isn't it more secure to write it in php since a visitor will not be able to tell it is dynamically created? But...
15
by: Good Man | last post by:
Hey there I have a dumb question.... Let's say i have a database full of 4000 people.... I select everything from the database by: $result = mysql_query("SELECT * FROM People");
4
by: Raymond Arthur St. Marie II of III | last post by:
very Very VERY dumb ? about the new Set( ) 's Please be kind and read this like you know I've been up 33-34 hours reading PEP's but... Doc\ref 2.6 Delimiters show's three unused characters "@...
2
by: Charles Alexander | last post by:
This is a really, really elementary (almost dumb) question. I have a php script I picked up elsewhere that I want to use to query my MySQL DB. I have phpMyAdmin. I'd like to somehow run this...
162
by: Isaac Grover | last post by:
Hi everyone, Just out of curiosity I recently pointed one of my hand-typed pages at the W3 Validator, and my hand-typed code was just ripped to shreds. Then I pointed some major sites...
2
by: Alex | last post by:
Hello I am interested learn more about .NET but am uncertain of exactly what niche it fills in the world of programming. (The more I read the more I am confused). What I am looking for is the...
2
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new...
6
by: Robert Dufour | last post by:
What is the meaning of the word marshal and unmarshal in plain english as applied to an exe file? Does it mean the application has started and ended? Thanks for any help, Happy new year, Bob
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.