View Full Version : Different Colour Links on the same page???
staffs alex
04-20-2007, 01:29 AM
I have a PHP calendar with each day as a link that the user can click on. To keep in line with the colours of my site I have made the links (dates) YELLOW and the background red. Below the calendar in the same page, I have a table which is populated by records from a table in my database. Each record has a reservationID which I have made a link aswell. Is there anyway to make these links in the table standard blue but keep my dates in yellow?
I have made the dates yellow by using:
<body bgcolor="#FFFFFF" link="#FFFF00" vlink="#FFFF00">
This is the line of code which shows the reservationID link:
<td> <center><font face=Arial size=2><a href=\"reservationinfo.php?id=$reservationID\">$reservationID</a></font></center>
Any ideas would be much appreciated.
Arbitrator
04-20-2007, 01:59 AM
The bgcolor, link, vlink, face, and size attributes are obsolete in favor of CSS; don’t use them. The same goes for the font and center elements; both are obsolete in favor of CSS.
You can use the following CSS to make all a elements on your site yellow with a red background except those that appear inside a table:
a { background: red; color: yellow; }
table a { color: blue; }
To replace the rest of your code, such as making the primary background white and changing how the content of a table cell appears, you would use something like:
html { background: white; }
td { text-align: center; font: large Arial, sans-serif; }
mamamia
04-20-2007, 02:02 AM
There are a number of ways to go about doing this using CSS. First and foremost I would suggest you begin using CSS stylesheets instead of defining your presentation (i.e. colors, decoration, etc.) in the html itself.
Now to answer your question. One way of doing it is to assign the table which lists the reservations an id. For example:
<table id="reservations">
<tr>
<td> <center><font face=Arial size=2><a href=\"reservationinfo.php?id=$reservationID\">$reservationID</a></font></center>
</td>
</r>
</table>
Then in your stylesheet you can define that all anchors/links under the reservation id be a certain color. This way you will be changing the colors of just anchors under that Id.
#reservations.a {color: #FFFF00;}
Another way, is to assign each and every anchor a class and then define that class with a certain font color in your stylesheet.
staffs alex
04-20-2007, 02:25 AM
cheers guys, ive ended up using
a { color: blue; }
#calendar a {color: #FFFF00;}
which simply makes every link blue apart from anything inside the calendar which it makes yellow.
thank you so much for your time in lookin into the matter!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.