Forum Moderators: not2easy

Message Too Old, No Replies

css hyperlinks

can you create hyperlinks in a css file?

         

tchilds

1:44 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



Sorry for the newbie question:

I use an external CSS file for my website. I want a set of hyperlinks to appear on every page in my web. I would like to put these hyperlinks in my CSS file so if I need to change a link, I only have to change it in one file (the external css file). Is there a way to accomplish this? I know that I can change the appearance of hyperlinks by using css rules, but didn't know if I could actually create hyperlinks in a css file. Thanks in advance.

BlobFisk

1:55 pm on Aug 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, tchilds!

This is not possible in CSS. You can restyle and position elements in CSS, but it is not the place to store you links.

This sounds more like a job for an include file. This is an external file that would contain your (say) naigational links, that appear on every page. A call is made on every page to this include file, meaning that you can make sitewide changes to you navigation by editing it in just one spot.

HTH

killroy

2:00 pm on Aug 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS is only for styling, not for content.

Look at server side includes for that.

SN

tchilds

3:09 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



Thank you Blobfisk and killroy!

Could either of you give me a small example of the coding of hyperlinks in an external include file and what code you would you place in the html document to bring in the include file (my navigational links). I probably have done this before, but do not know it by its correct technical terminology.

Thanks in advance.
tchilds.

BlobFisk

3:53 pm on Aug 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code of the links in your include file would be exactly the same as if they were in the page proper - plain old HTML/XHTML.

As for how to include a file, check out this thread [webmasterworld.com] and this thread [webmasterworld.com] should point you on your way!

toothfish

6:38 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



It's also super easy to do in PHP [us3.php.net].