very quick CSS question

Discussion in 'Programming' started by calisonder, Apr 25, 2007.

  1. #1
    i am posting an ad for a snake on a classified ad site, but i am not allowed to use the <body> or <head> tag, therefore i can't put css in the heading or put <body alink="" vlink="">in the code of the ad, i am only able to imput html that is normally conatined between the opening <html> and closing </html> tags.


    My problem is that i don't want my links to be the default purple and blue.

    Is there a way for me to put CSS in the body of the ad.

    Mabey in the <a href="mysite.html">My Site</a> Tag

    My other option that I didn't know if it would work or not: can i link in a <div> tag to a style sheet that is hosted on my personal webiste?

    for example <div style="http://www.mysite.com/mycss.css">


    thank you very much in advance
     
    calisonder, Apr 25, 2007 IP
  2. Webice

    Webice Peon

    Messages:
    49
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should try: <a href="mysite.html" style="color:#red !important;">...
    For the second question:
    You have 2 ways to import css styleheets:
    - using <style type="text/css">@import "style.css"; </style> before the body tag
    - using <link rel="stylesheet' href="style.css" type="text/css" /> before the body tag
    - or with javascript, but you have to have stylesheets loaded before the body element with <link elements

    <script type="text/javascript">
    function setActiveStyleSheet(title) {
    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
    a.disabled = true;
    if(a.getAttribute("title") == title) a.disabled = false;
    }
    }
    }
    </script>
     
    Webice, Apr 25, 2007 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    
    <a href="you.html" onmouseover="this.style.color='blue';" onmouseout="this.style.color='orange';" style="color: orange;">My Link</a>
    
    HTML:
    ??
     
    krakjoe, Apr 26, 2007 IP