Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    May 2010
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple but frustrating: Link not getting styled

    I am not getting my links styled and I don`t understand why. Here is an example of code not giving any result in my browsers, even after deleting cache. Any ideas?

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <?xml version="1.0" encoding="utf-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <style>
    body{
    	a:link {text-decoration: none; color: red;};
            a:hover {text-decoration: underline; color: white;}
    }
    </style>
    </head>
    <body>
    <p><a href="http://www.test.com">test</a></p>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,956
    Thanks
    9
    Thanked 727 Times in 721 Posts
    You don't need to wrap all your css in the body tags. Try:

    Code:
    <style type="text/css" media="screen">
    	a:link {text-decoration: none; color: red;};
            a:hover {text-decoration: underline; color: white;}
    </style>

  • #3
    New Coder
    Join Date
    May 2010
    Location
    Mexico
    Posts
    62
    Thanks
    1
    Thanked 0 Times in 0 Posts
    or
    Code:
    <style>
    body p{
    	a:link {text-decoration: none; color: red;};
            a:hover {text-decoration: underline; color: white;}
    }
    </style>
    or

    Code:
    <style>
    p{
    	a:link {text-decoration: none; color: red;};
            a:hover {text-decoration: underline; color: white;}
    }
    </style>
    Lo bueno del cine es que durante dos horas los problemas son de otros.

  • #4
    Regular Coder
    Join Date
    Apr 2008
    Posts
    685
    Thanks
    15
    Thanked 105 Times in 104 Posts
    @rakasav you mean:

    Code:
    body p a:link{text-decoration: none; color: red;}
    body p a:hover {text-decoration: underline; color: white;}
    or

    Code:
    p a:link{text-decoration: none; color: red;}
    p a:hover {text-decoration: underline; color: white;}
    Pseudo-Classes like :link and :hover should come after the selector before the block not inside the block { }!!

  • #5
    New Coder
    Join Date
    May 2010
    Location
    Mexico
    Posts
    62
    Thanks
    1
    Thanked 0 Times in 0 Posts
    both =) sorry i was a little distracted
    Lo bueno del cine es que durante dos horas los problemas son de otros.

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by Fullminster Buc View Post
    I am not getting my links styled and I don`t understand why. Here is an example of code not giving any result in my browsers, even after deleting cache. Any ideas?
    Off topic, but I'm loving the name.

  • #7
    New Coder
    Join Date
    May 2010
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks guys, case closed.
    Code:
    A:link {text-decoration: none; color: grey;}
    A:visited {text-decoration: none; color: grey;}
    A:active {text-decoration: none; color: grey;}
    A:hover {text-decoration: underline; color: black;}
    
    body{
    font-size:90%;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%; 
    max-height: 100%; 
    }
    etc.

  • #8
    New Coder
    Join Date
    May 2010
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Offtopic: glad you like it Astro, you`ve been creative yourself.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •