Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

another nested tags problem 1

Status
Not open for further replies.

ailse

Programmer
Jan 20, 2004
79
GB
Hi -

i'm getting in a muddle over using cgi.pm's html shortcuts... i need to display a link, which so far i can do as follows:

Code:
print $query -> a({-href=>"feedback.html"}, "Further information and feedback");

but I also need to make this link have font verdana, the unvisited and visited link colours to be #990033 and the "hover" colour to be "#660066" - is that possible to do by nesting the tags?

cheers for any advice :)
 
You probably want to write some Style sheet information to contain that information either directly in the head of the HTML output or link to the file in the head.

How to do it though: I don't know off hand. I'm a fan of using templates instead of having the HTML generated within my code.

- Rieekan
 
Code:
print $query -> a({-href=>"feedback.html"}, "<font name=verdana>Further information and feedback</font>");

but Rieekan is right, its a lot more maintainable to just give it a class and set it in a style

Code:
print $query -> a({-href=>"feedback.html"}, "<div class=\"someclass\">Further information and feedback</div>");

better then that is to use a template language like HTML::Mason etc to seperate your logic and presentation.
 
thanks so much for that - I will definitely look into the class and style solution, but for now I need something quickly - I also have a bulleted list:

Code:
print $query -> ul($query -> li(\@array));

where the font needs to be set to white, can I insert HTML tags in the above statement too?

thanks so much for your help :)
 
Not that I know of, I do not think that CGI.pm ever made the leap into the 21st century of stylesheets.

Everyone has pretty much moved on to more robust platforms that abstract the logic and presentation.
 
siberian, why muck about with <div>s? Just give the <a> a class:
Code:
print $query -> a({-href=>"feedback.html"
                   -class=>"someclass"},
                  "Further information and feedback");
Then contrive to get this into the <head> of your HTML document:
Code:
<style type="text/css">
a.someclass {
   font-family: verdana,
   color: #990033; 
}

a.someclass:hover {
   color: #660066;
}

ul li {
   color:#FFFFFF;
}
</style>
Though like the guys say, you're much better off putting the CSS declarations in a seperate style sheet file.

-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top