473,698 Members | 2,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1708
On 31 Aug 2004 06:36:36 -0700, Piedro <pp*****@hotmai l.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">F irst line (green and bold)</p>
<p class="deco2">S econd line (blue and underline)</p>
<p>Third line (red)</p>

The second:

<p><span class="deco1">F irst line (green and bold)</span><br>
<span class="deco2">S econd 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="threecol or">
<span class="first">F irst line</span>
<span class="second"> Second line</span>
<span class="third">T hird line</span>
</p>

CSS:
p.threecolor span.first{colo r:green;font-weight:bold;}
p.threecolor span.second{col or:blue;text-
decoration:unde rline;}
p.threecolor span.third{colo r: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*********@ti scali.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="threecol or">
<span class="first">F irst line</span>
<span class="second"> Second line</span>
<span class="third">T hird line</span>
</p>

CSS:
p.threecolor span.first{colo r:green;font-weight:bold;}
p.threecolor span.second{col or:blue;text-
decoration:unde rline;}
p.threecolor span.third{colo r:red;}

Jul 23 '05 #4
pp*****@hotmail .com (Piedro) wrote in news:b7e3650a.0 408310536.33f7e f78
@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">Thi rd 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
2509
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 if you write it in perl, you have to put it in your cgi-bin which automatically means it's a dynamically generated page? security by obscurity . Is this true or hardly means anything? thx!
15
2677
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
1699
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 "@ $ ?". @ sort of looks like and sort of sounds like a set an $ well sort of obvious. I can imagine that the $ would be confused for money and @ is ugly.
2
2105
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 script via phpMyAdmin so I can bookmark this for future reference. How do I do it? The phpMyadmin interface doesn't like the variable declarations like $query1="SELECT blah, blah"; when I do it manually.
162
7232
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 (microsoft.com, cnn.com, etc.) at the W3 Validator; to my surprise none of them passed. Doesn't anyone care anymore, or are the standards more-or-less looked at as guidlines for web design?
2
1384
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 ability ot write programs to work on mobile phones, as well as web pages, and to interact with servers. My background is a basic knowledge of VBA, XHTML and Java. Java can
2
2222
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 folder using whatever project name I supplied. Is there a work around for this? Thanks Bill
6
282
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
8683
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
9170
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...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
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
7741
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...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.