HighDots Forums  

Special Color for Table Element

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss Special Color for Table Element in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Special Color for Table Element - 10-27-2009 , 03:26 PM






I wish to apply a color change (style?) to a portion of a table
element. In the following code, I want to have the line:

<a href="http://zazoosh.com">** Race photos can be found at
www.ZaZoosh.com **</a>

be a different color (green) than all the other table elements. Note
that this table element appears in the middle of the table, and I want
only this line to be green - how do I accomplish this? TIA

<tr>
<td style="vertical-align:top;">October 24</td>
<td><a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a>
<br>
<a href="http://zazoosh.com">** Race photos can be found at
www.ZaZoosh.com **</a>
</td>
</tr>

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Special Color for Table Element - 10-27-2009 , 03:47 PM






Mike Copeland wrote:

Quote:
I wish to apply a color change (style?) to a portion of a table
element.
Doing color changes in HTML is early 1990s fashion. Nowadays people use CSS
(possibly together with JavaScript, for "dynamic" changes).

Quote:
In the following code, I want to have the line:

a href="http://zazoosh.com">** Race photos can be found at
www.ZaZoosh.com **</a

be a different color (green) than all the other table elements.
In HTML, you cannot. In HTML (which we discuss in this group), you can set
the color of _all_ links in some states, but not the color of a specific
link. Well, you could always play with <font color="...">...</font> inside
or outside the link element, just to see how modern browsers treat such
constructs that have no well-defined effect on rendering.

Note that <a> is not a table element. If it happens to sit on a table, oops
I mean in a cell in a table, that's coincidential.

Quote:
Note that this table element appears in the middle of the table, and I
want
only this line to be green - how do I accomplish this? TIA
Assign a class to the <a> element and use CSS to set the colors for it.
Beware that you can make it impossible to users to distinguish it as a link,
and you may get crazy in trying to figure out suitable colors. See "Links
Want To Be Links" (Google for it).

Quote:
tr
td style="vertical-align:top;">October 24</td
td><a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a
br
a href="http://zazoosh.com">** Race photos can be found at
www.ZaZoosh.com **</a
/td
/tr
I'm not sure what you are trying to accomplish, but to _highlight_ a link,
bolding or suitable background color or a border around might be better
ideas than green color. Note that the use of "**" for highlighting is
something that we should have abandoned when we were no longer confined to
our cells (i.e. character cell browsers, aka. "teletype browsing").

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Special Color for Table Element - 10-27-2009 , 03:56 PM



Quote:
I wish to apply a color change (style?) to a portion of a table
element.

Doing color changes in HTML is early 1990s fashion. Nowadays people use CSS
(possibly together with JavaScript, for "dynamic" changes).

In the following code, I want to have the line:

a href="http://zazoosh.com">** Race photos can be found at
www.ZaZoosh.com **</a

be a different color (green) than all the other table elements.

In HTML, you cannot. In HTML (which we discuss in this group), you can set
the color of _all_ links in some states, but not the color of a specific
link. Well, you could always play with <font color="...">...</font> inside
or outside the link element, just to see how modern browsers treat such
constructs that have no well-defined effect on rendering.

Note that <a> is not a table element. If it happens to sit on a table, oops
I mean in a cell in a table, that's coincidential.

Note that this table element appears in the middle of the table, and I
want
only this line to be green - how do I accomplish this? TIA

Assign a class to the <a> element and use CSS to set the colors for it.
Beware that you can make it impossible to users to distinguish it as a link,
and you may get crazy in trying to figure out suitable colors. See "Links
Want To Be Links" (Google for it).

tr
td style="vertical-align:top;">October 24</td
td><a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a
br
a href="http://zazoosh.com">** Race photos can be found at
www.ZaZoosh.com **</a
/td
/tr

I'm not sure what you are trying to accomplish, but to _highlight_ a link,
bolding or suitable background color or a border around might be better
ideas than green color. Note that the use of "**" for highlighting is
something that we should have abandoned when we were no longer confined to
our cells (i.e. character cell browsers, aka. "teletype browsing").

More information (that I had hoped wasn't needed): this code (not
mine, btw, but I have to maintain it) is in a .php file and is linked to
my site's main page. I wasn't sure if I could insert CSS into a .php
file, nor where to do it. Yes, I am only trying to get the line to
"stand out" from the many others that are displayed, because this
information and link are new and special. The "green color" wasn't
important - just an example of something different (I don't know how or
where the basic colors are set in the .php file...).

Reply With Quote
  #4  
Old   
Beauregard T. Shagnasty
 
Posts: n/a

Default Re: Special Color for Table Element - 10-27-2009 , 04:32 PM



Mike Copeland wrote:

Quote:
More information (that I had hoped wasn't needed): this code (not
mine, btw, but I have to maintain it)
You mean you didn't originally create it, but now it is your code, to
maintain.

Quote:
is in a .php file and is linked to my site's main page. I wasn't sure
if I could insert CSS into a .php file, nor where to do it. Yes, I
am only trying to get the line to "stand out" from the many others
that are displayed, because this information and link are new and
special. The "green color" wasn't important - just an example of
something different
You also didn't state if you want the entire cell to be "stand out" or
just one of the two links.

Quote:
(I don't know how or where the basic colors are set in the .php
file...).
The answer is: it depends. Inline CSS:

One link only:
<td>
<a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a>
<br>
<a style="background: green;"> href="http://zazoosh.com">Race photos can
be found at www.ZaZoosh.com</a>
</td>

Entire cell:
<td style-"background: green;">
<a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a>
<br>
<a href="http://zazoosh.com">Race photos can be found at
www.ZaZoosh.com</a>
</td>

But if it was me, I'd tell you to look up CSS style sheets, and use a
class in whichever place you wanted to "stand out."

<td class="standout">
<a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a>
<br>
<a href="http://zazoosh.com">Race photos can be found at
www.ZaZoosh.com</a>
</td>

...and in the CSS style sheet:

..standout { background: green; }

Without seeing the PHP code, it would be a guess as to how to tell you
to address the style sheet (but it is simple to do so).

http://htmldog.com/guides/cssbeginner/

--
-bts
-Friends don't let friends drive Windows

Reply With Quote
  #5  
Old   
AT
 
Posts: n/a

Default Re: Special Color for Table Element - 10-27-2009 , 05:28 PM



Quote:
More information (that I had hoped wasn't needed): this code (not
mine, btw, but I have to maintain it)

You mean you didn't originally create it, but now it is your code, to
maintain.
Yes.
Quote:
is in a .php file and is linked to my site's main page. I wasn't sure
if I could insert CSS into a .php file, nor where to do it. Yes, I
am only trying to get the line to "stand out" from the many others
that are displayed, because this information and link are new and
special. The "green color" wasn't important - just an example of
something different

You also didn't state if you want the entire cell to be "stand out" or
just one of the two links.

(I don't know how or where the basic colors are set in the .php
file...).

The answer is: it depends. Inline CSS:
This change is (1) rushed and (2) a prototype for analysis by my
boss. If it's the sort of thing he wants, I will look into a better,
more robust technique for future enhancements.
Quote:
One link only:
td
a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a
br
a style="background: green;"> href="http://zazoosh.com">Race photos can
be found at www.ZaZoosh.com</a
/td

That works for now - thanks!

Quote:
Entire cell:
td style-"background: green;"
a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a
br
a href="http://zazoosh.com">Race photos can be found at
www.ZaZoosh.com</a
/td

But if it was me, I'd tell you to look up CSS style sheets, and use a
class in whichever place you wanted to "stand out."

td class="standout"
a href="http://results.active.com/pages/page.jsp?eventID=
1765035">41st Annual GoDaddy.com ® YMCA Half Marathon + Family 5K</a
br
a href="http://zazoosh.com">Race photos can be found at
www.ZaZoosh.com</a
I will consider this. 8<}}

Reply With Quote
  #6  
Old   
Beauregard T. Shagnasty
 
Posts: n/a

Default Re: Special Color for Table Element - 10-27-2009 , 06:24 PM



Mike Copeland wrote:

Quote:
That works for now - thanks!
Super!

CSS is easy, once you are able to wrap your neurons around the concept.

Please do not snip attributes from your posts. Thanks.

--
-bts
-Friends don't let friends drive Windows

Reply With Quote
  #7  
Old   
dorayme
 
Posts: n/a

Default Re: Special Color for Table Element - 10-27-2009 , 07:25 PM



In article <hc7rv3$7rm$1 (AT) news (DOT) eternal-september.org>,
"Beauregard T. Shagnasty" <a.nony.mous (AT) example (DOT) invalid> wrote:

Quote:
CSS is easy, once you are able to wrap your neurons around the concept.
Unlike, say, Quantum Physics.

--
dorayme

Reply With Quote
  #8  
Old   
Swifty
 
Posts: n/a

Default Re: Special Color for Table Element - 10-28-2009 , 06:48 AM



dorayme wrote:
Quote:
In article <hc7rv3$7rm$1 (AT) news (DOT) eternal-september.org>,
"Beauregard T. Shagnasty" <a.nony.mous (AT) example (DOT) invalid> wrote:

CSS is easy, once you are able to wrap your neurons around the concept.

Unlike, say, Quantum Physics.
Yup, that's neutrons.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

Reply With Quote
  #9  
Old   
Beauregard T. Shagnasty
 
Posts: n/a

Default Re: Special Color for Table Element - 10-28-2009 , 08:14 AM



Swifty wrote:

Quote:
dorayme wrote:
"Beauregard T. Shagnasty" wrote:
CSS is easy, once you are able to wrap your neurons around the
concept.

Unlike, say, Quantum Physics.

Yup, that's neutrons.
<g>

--
-bts
-Friends don't let friends drive synapses

Reply With Quote
  #10  
Old   
Andy Dingley
 
Posts: n/a

Default Re: Special Color for Table Element - 10-28-2009 , 10:37 AM



On 27 Oct, 19:26, mrc2... (AT) cox (DOT) net (Mike Copeland) wrote:
Quote:
* *I wish to apply a color change (style?) to a portion of a table
element. *In the following code, I want to have the line:

a href="http://zazoosh.com">** Race photos can be found atwww.ZaZoosh.com**</a

be a different color (green) than all the other table elements. *
It's not clear precisely what you're after. Tables have rows, rows
have cells, one of your cells has a link in it.

If you want to make the "line" turn green, do you mean the whole row,
or just the link?

Let's assume that you mean rows. Neatly you could do this:

<tr class="my-highlight-thingy" >

and somewhere else in the CSS stylesheet (one place, top of the page)

..my-highlight-thingy {
background-color: lightgreen;
color: black;
}


Now you might not be able to modify the CSS already in use on the
page, or to add any additional CSS stylesheet in the <head> of the
page. In that case, you can place the CSS properties inside the HTML
like this:

<tr class="my-highlight-thingy" style="background-color: lightgreen;"
Quote:

If OTOH, you want to change the link's colour but not the whole row,
then use a more specific selector in the CSS like this:

<tr class="my-highlight-thingy" >

..my-highlight-thingy a {
background-color: lightgreen;
}

I'd still recommend placing the class on the <tr>, if that's the scope
of what the highlight selection applies to - even if you only want the
link to change colour. If you're stuck without access to the CSS (as
above), then you'd need to modify the HTML like this:

<a style="background-color: lightgreen;" >

You can also use the :hover pseudo-selector to control the colour of
the link text when you mouseover it. However this one does need access
to a CSS stylesheet, not just the HTML.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.