newbie question (hopefully)

Discussion in 'CSS' started by its me, May 28, 2007.

  1. #1
    i'm making a site which is using css and i wanted to use links on my pages to other sites.

    the links section is there already on the page and default links in them. but is there a way i can add this to the css so i can easily edit the links on the style sheet without having to go through every page and edit them seperatly?
     
    its me, May 28, 2007 IP
  2. Mr Blonde

    Mr Blonde Guest

    Messages:
    142
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    add this between the <head> tags on the pages... <link href="styles.css" rel="stylesheet" type="text/css" /> and then style them appropriately in the external stylesheet.
     
    Mr Blonde, May 28, 2007 IP
  3. its me

    its me Active Member

    Messages:
    245
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    how do i style them in the stylesheet? i dont have any experience with css.
     
    its me, May 28, 2007 IP
  4. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #4
    Im not sure if CSS is what you need here. Are you wanting to change the way the links appear or change the actual links themsleves?

    CSS would be useful to change the appearance, but not the links themselves. If that is what you need then you may want to use a php include for that. Are your pages using .php extension?
     
    kentuckyslone, May 28, 2007 IP
  5. Fold

    Fold Peon

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The way to style all links is as follows:

    a:link, a:active {
     /* styles for links in their default states */
    }
    
    a:hover, a:focus {
     /* hover styles for links */
    }
    
    a:visited {
     /* styles for links that have already been visited */
    }
    Code (markup):
    If you don't want to change all links you will have to make these styles a bit more specific, for example identify the div the links are in (lets say it's in a div with a class of "links"):

    
    .links a:link, .links a:active {
     /* etc */
    }
    
    Code (markup):
     
    Fold, May 29, 2007 IP
  6. its me

    its me Active Member

    Messages:
    245
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #6
    aye its to change the actual links themselves. my pages are .htm, not .php. i looked for a free javascript that would easily change the links for me, but the only scripts i can find are for banner rotation. so i thought i might be able to do it in the css.
     
    its me, May 29, 2007 IP
  7. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #7
    You need to do this server side, not on the client (javascript). Use server side includes. All server side languages support an include method, as do web servers. Google is your friend.

    cheers,

    gary
     
    kk5st, May 29, 2007 IP
  8. Mr Blonde

    Mr Blonde Guest

    Messages:
    142
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    yeah gary's right for what you need. CSS is purely presentational... it is used to style existing elements within the html.

    What you need are server side includes. If you change your file types to php or shtml you can just add this in the page
    <?
    include('links.html');
    ?>
    Code (markup):
    and store the links in links.html.
     
    Mr Blonde, May 29, 2007 IP
  9. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #9
    I dont know of any way to use server side includes in html files. I am sure that you would not want to change all your html files to php as this could wreck havoc with your SERPs.
     
    kentuckyslone, May 29, 2007 IP
  10. Mr Blonde

    Mr Blonde Guest

    Messages:
    142
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    then just place this code in your httpd.conf file:
     AddType application/x-httpd-php .php .html
    Code (markup):
    and then use a 301 redirect to redirect from the .html files to the .php files by adding this to the .htaccess file in the root of your site
    RedirectMatch 301 ^/(.*)\.html$ http://www.yourdomain.com/$1.php
    Code (markup):
    All this does is tells apache to parse all .html files as .php files so there is no need to change your extensions on the actual files and your serp rankings wont be affected at all either
     
    Mr Blonde, May 29, 2007 IP
  11. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0